I think I've found a problem with how HttpProt handles relocation.

First, I have to give some background.  I'm using Turbo Delphi 2006 and 
using an older version of ICS (HttpProt.pas ver 1.94 last updated 
12/10/06).  I haven't kept up with the latest revisions or followed them 
too closely so I didn't know if this problem had been corrected in a later 
version.  To try to find out, I downloaded some later versions from the 
Overbyte web site.  I checked: OverbyteIcsV5.zip (HttpProt.pas  ver 1.94 
last updated: 7/13/08) and OverbyteIcsV6_RC1.zip (OverbyteIcsHttpProt.pas 
ver 6.00.5 last updated: 6/25/08) and OverbyteIcsV7_Alpha1.zip 
(OverbyteIcsHttpProt.pas ver 6.00.6 last updated: 7/17/08).  I found the 
same problem in each of these versions so I think I need to bring it to 
people's attention.

The problem is in: THttpCli.GetHeaderLineNext where it's handling a 
non-proxy relocation to an absolute location (near line 2800 in the 
source).  The code is:

                 { We are not using a proxy }
                 else begin
                     if Data[1] = '/' then begin
                         { Absolute location }
                         FPath     := Data;
                         if Proto = '' then
                             Proto := 'http';
                         FLocation := Proto + '://' + FHostName + FPath;
                     end

The problem is that Proto has never been set at this time.  When the check 
(if Proto = '' then) is made, the relocation will switch us from https to 
http.  I modified the code to the following:

                 { We are not using a proxy }
                 else begin
                     ParseURL(FURL, proto, user, pass, Host, port, Path);
                     if Data[1] = '/' then begin
                         { Absolute location }
                         FPath     := Data;
                         if Proto = '' then
                             Proto := 'http';
                         FLocation := Proto + '://' + FHostName + FPath;
                     end

This corrected the problem for me.  It should also correct the same problem 
for Relative location in the next block of code.

Since I'm not working with the latest versions, I thought I'd pass this 
along so that someone who is working with the current version could correct it.

Thanks.
Steve

-- 
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

Reply via email to