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;
|
end;
|
||||||
|
|
||||||
function TMVCWebRequest.Body: string;
|
function TMVCWebRequest.Body: string;
|
||||||
{ .$IF CompilerVersion <= 27 }
|
|
||||||
var
|
var
|
||||||
InEnc: TEncoding;
|
Encoding: TEncoding;
|
||||||
TestBuffer, Buffer: TArray<Byte>;
|
Buffer: TArray<Byte>;
|
||||||
I: Integer;
|
I: Integer;
|
||||||
{ .$ENDIF }
|
|
||||||
begin
|
begin
|
||||||
if FBody <> '' then
|
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
|
|
||||||
begin
|
begin
|
||||||
SetLength(TestBuffer, 10);
|
if (FCharset = '') then
|
||||||
for I := 0 to 9 do
|
|
||||||
begin
|
begin
|
||||||
TestBuffer[I] := Buffer[I];
|
SetLength(Buffer, 10);
|
||||||
end;
|
for I := 0 to 9 do
|
||||||
TEncoding.GetBufferEncoding(TestBuffer, InEnc, TEncoding.Default);
|
Buffer[I] := FWebRequest.RawContent[I];
|
||||||
SetLength(TestBuffer, 0);
|
TEncoding.GetBufferEncoding(Buffer, Encoding, TEncoding.Default);
|
||||||
end
|
SetLength(Buffer, 0);
|
||||||
else
|
end
|
||||||
begin
|
else
|
||||||
InEnc := TEncoding.GetEncoding(FCharset);
|
Encoding := TEncoding.GetEncoding(FCharset);
|
||||||
|
FBody := Encoding.GetString(FWebRequest.RawContent);
|
||||||
end;
|
end;
|
||||||
|
Result := FBody;
|
||||||
try
|
|
||||||
FBody := InEnc.GetString(Buffer);
|
|
||||||
Result := FBody;
|
|
||||||
finally
|
|
||||||
InEnc.Free;
|
|
||||||
end
|
|
||||||
{ .$ENDIF }
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TMVCWebRequest.BodyAs<T>(const RootProperty: string): T;
|
function TMVCWebRequest.BodyAs<T>(const RootProperty: string): T;
|
||||||
|
Loading…
Reference in New Issue
Block a user