Frans van Daalen wrote:
> If you want me to
> check it in detail just let me know and I will do so for you.

Thanks, could you please check my small changes below? Try with both
HTTP 1.0/1.1, with as well as w/o property Connection set to 'Keep-Alive'/
'Close'.
It's working here using GET, only I'm not sure whether it might have some
other side effects, RequestDone is not triggered on each relocation.   
Problem URL: http://feeds.feedburner.com/foxsports/RSS/headlines?m=4765
leads to three relocations, first goes to a different host.


1 - procedure THttpCli.GetHeaderLineNext

[..]
{ FContentLength = -1 when server doesn't send a value }
        if ((FContentLength = -1) and          { Added 12/03/2004 }
            ((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 // not FCloseReq
=>              if FLocationFlag then          
=>                  StartRelocation             
                else                           
                    SetReady;
=>          end;
            Exit;
        end;
[..]


2 - Not so important, but LocationChangeCurCount has been counted incorrectly.
procedure THttpCli.StartRelocation
[..]
    FRcvdCount        := 0;
    FReceiveLen       := 0;
    FHeaderLineCount  := 0;
    FBodyLineCount    := 0;

    if {(FResponseVer     = '1.1') and}
        { [rawbite 31.08.2004 Connection controll] }
       (FCurrentHost     = FHostName) and
       (FCurrentPort     = FPort) and
       (FCurrentProtocol = FProtocol) and
       (not FCloseReq) then begin      { SAE 01/06/04 }

        { This block moved 03/07/2006 }
=>      {  V1.90 25 Nov 2005 - restrict number of relocations to avoid 
continuous loops }
        inc (FLocationChangeCurCount) ;
        if FLocationChangeCurCount > FLocationChangeMaxCount then begin
            AllowMoreRelocations := false;
            if Assigned (FOnLocationChangeExceeded) then
                FOnLocationChangeExceeded(Self, FLocationChangeCurCount,
                                      AllowMoreRelocations);
            if not AllowMoreRelocations then begin
                SetReady;
                exit;
            end;
=>      end;

        { No need to disconnect }
        { Trigger the location changed event  27/04/2003 }
[..]


---
Arno Garrels [TeamICS]
http://www.overbyte.be/eng/overbyte/teamics.html


Frans van Daalen wrote:
> ----- Original Message -----
> From: "Arno Garrels" <[EMAIL PROTECTED]>
> ..>
>> Since I've never been using THttpCli in one of my applications I'm
>> not very familiar with HTTP as well as the THttpCli. That's why I
>> wonder whether it is intented to trigger RequestDone on each
>> relocation or not (sometimes it's triggered in V5, V6 sometimesnot),
>> probably someone more familiar with the component can clear me up?
>> With two simple changes I can make the FollowRelocation feature
>> working for the problem URL of the OP, however w/o RequestDone being
>> triggered on relocation.
>> 
>> 
> If I remember correctly, to late to really check it :), requestdone
> is only triggered after relocate is finished (followreloc is true). I
> use v6 beta and the thttpcli for some years now. If you want me to
> check it in detail just let me know and I will do so for you.
-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://www.elists.org/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be

Reply via email to