|
@@ -656,7 +656,8 @@ procedure TFPCustomHTTPClient.SendRequest(const AMethod: String; URI: TURI);
|
|
Var
|
|
Var
|
|
PH,UN,PW,S,L : String;
|
|
PH,UN,PW,S,L : String;
|
|
I : Integer;
|
|
I : Integer;
|
|
-
|
|
|
|
|
|
+ AddContentLength : Boolean;
|
|
|
|
+
|
|
begin
|
|
begin
|
|
S:=Uppercase(AMethod)+' '+GetServerURL(URI)+' '+'HTTP/'+FHTTPVersion+CRLF;
|
|
S:=Uppercase(AMethod)+' '+GetServerURL(URI)+' '+'HTTP/'+FHTTPVersion+CRLF;
|
|
UN:=URI.Username;
|
|
UN:=URI.Username;
|
|
@@ -683,7 +684,8 @@ begin
|
|
If (URI.Port<>0) then
|
|
If (URI.Port<>0) then
|
|
S:=S+':'+IntToStr(URI.Port);
|
|
S:=S+':'+IntToStr(URI.Port);
|
|
S:=S+CRLF;
|
|
S:=S+CRLF;
|
|
- If Assigned(RequestBody) and (IndexOfHeader('Content-Length')=-1) then
|
|
|
|
|
|
+ AddContentLength:=Assigned(RequestBody) and (IndexOfHeader('Content-Length')=-1);
|
|
|
|
+ If AddContentLength then
|
|
AddHeader('Content-Length',IntToStr(RequestBody.Size));
|
|
AddHeader('Content-Length',IntToStr(RequestBody.Size));
|
|
CheckConnectionCloseHeader;
|
|
CheckConnectionCloseHeader;
|
|
For I:=0 to FRequestHeaders.Count-1 do
|
|
For I:=0 to FRequestHeaders.Count-1 do
|
|
@@ -692,6 +694,8 @@ begin
|
|
If AllowHeader(L) then
|
|
If AllowHeader(L) then
|
|
S:=S+L+CRLF;
|
|
S:=S+L+CRLF;
|
|
end;
|
|
end;
|
|
|
|
+ If AddContentLength then
|
|
|
|
+ FRequestHeaders.Delete(FRequestHeaders.IndexOfName('Content-Length'));
|
|
if Assigned(FCookies) then
|
|
if Assigned(FCookies) then
|
|
begin
|
|
begin
|
|
L:='Cookie: ';
|
|
L:='Cookie: ';
|