mirror of
https://github.com/danieleteti/delphimvcframework.git
synced 2024-11-16 00:05:53 +01:00
Merge pull request #69 from ezequieljuliano/master
Problem with body request in Apache module
This commit is contained in:
commit
96e5e64eec
@ -1 +1 @@
|
||||
Subproject commit 6724ff46bbfae41129e5c54bd4a7fc991de55129
|
||||
Subproject commit 9f8e42281d25ab6006a7ea30495927e50502231b
|
@ -1 +1 @@
|
||||
Subproject commit cd36a96d19c983f3b59d27e9d4d127feb9f297ac
|
||||
Subproject commit c1dee7fb384f3c0b87630dde47c077c335f395dc
|
@ -1636,50 +1636,26 @@ begin
|
||||
end;
|
||||
|
||||
function TMVCWebRequest.Body: string;
|
||||
{ .$IF CompilerVersion <= 27 }
|
||||
var
|
||||
InEnc: TEncoding;
|
||||
TestBuffer, Buffer: TArray<Byte>;
|
||||
Encoding: TEncoding;
|
||||
Buffer: TArray<Byte>;
|
||||
I: Integer;
|
||||
{ .$ENDIF }
|
||||
begin
|
||||
if FBody <> '' then
|
||||
Exit(FBody);
|
||||
|
||||
{ .$IF CompilerVersion > 29 }
|
||||
// FWebRequest.ReadTotalContent;
|
||||
// Exit(FWebRequest.Content);
|
||||
{ .$ELSE }
|
||||
// Property FWebRequest.Content is broken. It doesn't correctly decode the response body
|
||||
// considering the content charser. So, here's the fix
|
||||
// check http://msdn.microsoft.com/en-us/library/dd317756(VS.85).aspx
|
||||
// FWebRequest.ReadTotalContent;
|
||||
|
||||
SetLength(Buffer, FWebRequest.ContentLength);
|
||||
FWebRequest.ReadClient(Buffer[0], FWebRequest.ContentLength);
|
||||
|
||||
if FCharset.IsEmpty then
|
||||
if (FBody = '') then
|
||||
begin
|
||||
SetLength(TestBuffer, 10);
|
||||
for I := 0 to 9 do
|
||||
if (FCharset = '') then
|
||||
begin
|
||||
TestBuffer[I] := Buffer[I];
|
||||
end;
|
||||
TEncoding.GetBufferEncoding(TestBuffer, InEnc, TEncoding.Default);
|
||||
SetLength(TestBuffer, 0);
|
||||
end
|
||||
else
|
||||
begin
|
||||
InEnc := TEncoding.GetEncoding(FCharset);
|
||||
SetLength(Buffer, 10);
|
||||
for I := 0 to 9 do
|
||||
Buffer[I] := FWebRequest.RawContent[I];
|
||||
TEncoding.GetBufferEncoding(Buffer, Encoding, TEncoding.Default);
|
||||
SetLength(Buffer, 0);
|
||||
end
|
||||
else
|
||||
Encoding := TEncoding.GetEncoding(FCharset);
|
||||
FBody := Encoding.GetString(FWebRequest.RawContent);
|
||||
end;
|
||||
|
||||
try
|
||||
FBody := InEnc.GetString(Buffer);
|
||||
Result := FBody;
|
||||
finally
|
||||
InEnc.Free;
|
||||
end
|
||||
{ .$ENDIF }
|
||||
Result := FBody;
|
||||
end;
|
||||
|
||||
function TMVCWebRequest.BodyAs<T>(const RootProperty: string): T;
|
||||
|
Loading…
Reference in New Issue
Block a user