Computers are not my strength, so I am trying my best to speak in your 
language.

>>> There is no reason to call Abort from OnRequestDone
>>> which is the time when the request is... done !
>>> Why do you think you need to call Abort from OnRequestDone ?

I do NOT want to call Abort from OnRequestDone.  It is called from 
OnHeaderEnd.

>
> This is really important you answer the questions.
> Giving details on what you see in your program is not relevant until I
> understand what you want to do. You have to explain at a much higher level
> than giving details about status code.
> State variable is just for information. You_must_ use the events. You 
> can't
> poll the state and do whatever you want. Operations has to be done from 
> the
> events or _after_ OnRequestDone event. Abort can be called at anytime,
> outside of any event and the result is unpredictable except the fact that
> the current operation will be aborted or course.

Here is how I handle events:

Objective, to download several files, very similar to the Httpasy demo:
On GoButton.Click:  HttpCli.GetASync
OnHeaderEnd:  Check if the file to be downloaded is good.  If not, ABORT.
OnRequestDone: If ABORT, then clear the file, if not store the downloaded 
file.  Then get the next file.

The problem is that IF the statuscode is 302 and I Abort, then I cannot get 
the next file because the component is busy. (httpDNSLookup).
I have solved this problem by having the first line in OnRequestDone check 
the status, and only execute the routine if it is httpReady.
(i.e.
Procedure OnRequestDone
begin
if httpcli.state = httpReady then
  begin
  the rest of the OnRequestDone code;
  end;
end;
)
My question is:  Is there a bug in the component, or is there a better 
method of doing this?


----- Original Message ----- 
From: "Francois PIETTE" <[EMAIL PROTECTED]>
To: "ICS support mailing" <twsocket@elists.org>
Sent: Sunday, February 26, 2006 6:21 AM
Subject: Re: [twsocket] HttpCli problem


>> Thank you for the feedback, Francois and Wilfried.  I have not been clear
>> in
>> my explination.  Let me start again with more detail:
>
> Before I answer more, probably for nothing, please answer the questions I
> asked in my previous mail:
>


>
> --
> [EMAIL PROTECTED]
> http://www.overbyte.be
>
>
> ----- Original Message ----- 
> From: "Ronny" <[EMAIL PROTECTED]>
> To: "ICS support mailing" <twsocket@elists.org>
> Sent: Sunday, February 26, 2006 12:24 AM
> Subject: Re: [twsocket] HttpCli problem
>
>
>> Thank you for the feedback, Francois and Wilfried.  I have not been clear
>> in
>> my explination.  Let me start again with more detail:
>>
>> State: httpReady
>> I call  httpcli.GetASync.
>> State: httpDnsLookup
>>
>> ( on HeaderEnd)
>> State: httpWaitingHeader   StatusCode: 302
>> I call httpcli.About
>> State: httpReady
>>
>> (OnRequestDone)
>> State: httpDNSLookup
>>
>> Nothing is done between OnHeaderEnd and OnRequestDone, so I assume that
>> httpcli is looking for the redirect. (This only happens with a 302
>> StatusCode, with a 200 Statuscode, OnRequestDone state is httpReady).
>>
>> If this is a 'Feature' and not a bug, then can I Abort again in the
>> OnRequestDone?  Or what do you recommend?  I do not think that the second
>> DNSLookup will provide me with any useful information, even if it is a
>> redirect, I wouldn't know how to use it, so I might as well cancel it and
>> try to get the next file.
>>
>>
>> ----- Original Message ----- 
>> From: "Francois PIETTE" <[EMAIL PROTECTED]>
>> To: "ICS support mailing" <twsocket@elists.org>
>> Sent: Saturday, February 25, 2006 1:12 PM
>> Subject: Re: [twsocket] HttpCli problem
>>
>>
>>>>> Why use a loop ?
>>>>> Why don't you want to use OnRequestDone event ?
>>>
>>>> That is the problem. This routine is called from OnRequestDone.  That 
>>>> is
>>>> why
>>>> I think that there is a bug.  OnRequestDone gets called twice for 302s,
>>>> but
>>>> I have already taken that into account.
>>>> Should httpcli.State = httpReady when OnRequestDone is called?   If so,
>>>> this
>>>> is not the case with 302.
>>>
>>> There is no reason to call Abort from OnRequestDone which is the time
>>> when
>>> the request is... done !
>>> Why do you think you need to call Abort from OnRequestDone ?
>>> I you really have a good reason (I like to hear it), then PostMessage a
>>> custom message and then exit. Then from the corresponding event handler,
>>> call Abort.
>>>
>>> --
>>> Contribute to the SSL Effort. Visit http://www.overbyte.be/eng/ssl.html
>>> --
>>> [EMAIL PROTECTED]
>>> http://www.overbyte.be
>>>
>>>
>>>
>>> -- 
>>> 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
>>
>> -- 
>> 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
>
> -- 
> 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 

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