>From a brief test, the server sends body data even though it got a
HEAD-request, the following modification may help?
procedure THttpCli.GetHeaderLineNext;
[..]
{ FContentLength = -1 when server doesn't send a value }
if ((FContentLength = -1) and { Added 12/03/2004 }
(FTransferEncoding <> 'chunked') and { Added 09/10/2006 by FP }
((FStatusCode < 200) or { Added 12/03/2004 }
(FStatusCode = 204) or { Added 12/03/2004 }
(FStatusCode = 301) or { Added 06/10/2004 }
(FStatusCode = 302) or { Added 06/10/2004 }
(FStatusCode = 304) or { Added 12/03/2004 }
(FStatusCode = 401) or { Added 12/28/2005 } //AG
12/28/05
(FStatusCode = 407))) { Added 12/28/2005 } //AG
12/28/05
or
(FContentLength = 0)
or
(FRequestType = httpHEAD) then begin
{ TriggerHeaderEnd; }{ Removed 10/01/2004 }
if {(FResponseVer = '1.0') or (FRequestVer = '1.0') or}
{ [rawbite 31.08.2004 Connection controll] }
FCloseReq then begin
if FLocationFlag then { Added 16/02/2004 }
StartRelocation { Added 16/02/2004 }
else begin { Added 16/02/2004 }
if FRequestType = httpHEAD then begin { Added 23/07/04 }
{ With HEAD command, we don't expect a document }
{ but some server send one ! }
FReceiveLen := 0; { Cancel received data }
StateChange(httpWaitingBody);
FNext := nil;
end;
FCtrlSocket.CloseDelayed; { Added 10/01/2004 }
end;
end
else begin //AG
05/27/08
{ With HEAD command, we don't expect a document } //AG
05/27/08
{ but some server send one ! } //AG
05/27/08
FReceiveLen := 0; { Cancel received data } //AG
05/27/08
StateChange(httpWaitingBody); //AG
05/27/08
FNext := nil; //AG
05/27/08
SetReady;
end; //AG
05/27/08
Exit;
end;
DocExt := LowerCase(ExtractFileExt(FDocName));
[..]
--
Arno Garrels
--
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be