Hello at all,
this is my first post in this mailinglist. Please forgive my bad english.:)
I think i found a BUG in the THttpCli component but i'm not 100% sure.
* The situation:
You use a proxy (Fiddler) and try to download a website with relocation
302.
* The problem:
The component doesn't relocate by a relocation with statuscode 302.
* The solution:
If i change the following lines in the function "GetHeaderLineNext" it
solves my problem.
(I have comment the relevant lines -> HH - 18.05.2009)
...
FLocationFlag := TRUE;
if Proxy <> '' then begin
{ We are using a proxy }
if Data[1] = '/' then begin
{ Absolute location }
ParseURL(FPath, proto, user, pass, Host, port,
Path);
if Proto = '' then
Proto := 'http';
FLocation := Proto + '://' + Host + Data;
FPath := FLocation;
if (user <> '') and (pass <> '') then begin
{ save user and password given in location @@@}
FCurrUsername := user;
FCurrPassword := pass;
end;
end
else if (CompareText(Copy(Data, 1, 7), 'http://') <> 0)
and { 05/02/2005 }
(CompareText(Copy(Data, 1, 8), 'https://') <> 0)
then begin
{ Relative location }
FPath := GetBaseUrl(FPath) + Data;
{ if Proto = '' then
Proto := 'http';
FLocation := Proto + '://' + FHostName + '/' +
FPath;
}
FLocation := FPath;
end
else begin
ParseURL(Data, proto, user, pass, Host, port, Path);
// >>> HH - 18.05.2009 * The proxy must handle the port
//if port <> '' then
//FPort := port
//else begin
//{$IFDEF USE_SSL}
//if proto = 'https' then
//FPort := '443'
//else
//{$ENDIF}
//FPort := '80';
//end;
// <<<
if (user <> '') and (pass <> '') then begin
{ save user and password given in location @@@}
FCurrUsername := user;
FCurrPassword := pass;
end;
if (Proto <> '') and (Host <> '') then begin
{ We have a full relocation URL }
FTargetHost := Host;
FLocation := Proto + '://' + Host + Path;
FPath := FLocation;
end
else begin
if Proto = '' then
Proto := 'http';
if FPath = '' then
FLocation := Proto + '://' + FTargetHost
+ '/' + Host
else if Host = '' then
FLocation := Proto + '://' + FTargetHost
+ FPath
else
FTargetHost := Host;
end;
// HH - 18.05.2009 * Now the proxy becomes the port
if (FLocation <> '') and (port <> '') then
FLocation := FLocation + ':' + port;
end;
end
{ We are not using a proxy }
else begin
...
I hope you understand my problem and can affirm me that the solution is
right.
greets
Mordilion
P.S.: I used the last SVN-Version of the components.
--
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