mirror of
https://github.com/danieleteti/delphimvcframework.git
synced 2024-11-16 00:05:53 +01:00
Merge pull request #7 from petdr/master
Add content-length header to frames.
This commit is contained in:
commit
31001af0cb
@ -405,6 +405,10 @@ begin
|
||||
h := AHeaders.GetAt(i);
|
||||
AFrame.GetHeaders.Add(h.Key, h.Value);
|
||||
end;
|
||||
|
||||
// If the frame has some content, then set the length of that content.
|
||||
if (AFrame.ContentLength > 0) then
|
||||
AFrame.GetHeaders.Add('content-length', IntToStr(AFrame.ContentLength));
|
||||
end;
|
||||
|
||||
procedure TStompClient.Nack(const MessageID, TransactionIdentifier: string);
|
||||
|
@ -63,6 +63,7 @@ type
|
||||
procedure SetBody(const Value: string);
|
||||
function GetHeaders: IStompHeaders;
|
||||
function MessageID: string;
|
||||
function ContentLength: Integer;
|
||||
end;
|
||||
|
||||
IStompClient = interface
|
||||
@ -136,6 +137,7 @@ type
|
||||
private
|
||||
FCommand: string;
|
||||
FBody: string;
|
||||
FContentLength: Integer;
|
||||
FHeaders: IStompHeaders;
|
||||
procedure SetHeaders(const Value: IStompHeaders);
|
||||
function GetCommand: string;
|
||||
@ -153,6 +155,7 @@ type
|
||||
// otherwise, return Value;
|
||||
function Output: string;
|
||||
function MessageID: string;
|
||||
function ContentLength: Integer;
|
||||
property Headers: IStompHeaders read GetHeaders write SetHeaders;
|
||||
end;
|
||||
|
||||
@ -286,6 +289,7 @@ begin
|
||||
FHeaders := TStompHeaders.Create;
|
||||
self.FCommand := '';
|
||||
self.FBody := '';
|
||||
self.FContentLength := 0;
|
||||
end;
|
||||
|
||||
destructor TStompFrame.Destroy;
|
||||
@ -319,9 +323,15 @@ begin
|
||||
COMMAND_END;
|
||||
end;
|
||||
|
||||
function TStompFrame.ContentLength: Integer;
|
||||
begin
|
||||
Result := FContentLength;
|
||||
end;
|
||||
|
||||
procedure TStompFrame.SetBody(const Value: string);
|
||||
begin
|
||||
FBody := Value;
|
||||
FContentLength := Length(TEncoding.UTF8.GetBytes(FBody));
|
||||
end;
|
||||
|
||||
procedure TStompFrame.SetCommand(const Value: string);
|
||||
|
Loading…
Reference in New Issue
Block a user