Okay, I definitely reproduced the behavior you're describing. I used some
old code that I once used for some spidering experiments. It iteratively
parses each page it retrieves and then follows each link etc.

No OnRequestDone event in case of certain Aborts. The example I found:
Aborting from within the OnLocationChange event-handler on a site that does
two redirects of which the second is a 302 re-direct. The LocationChange
event handler calls Abort() during the first re-direct. After this, no
RequestDone is generated anymore (but the second LocationChange is). Not
calling Abort from within the LocationChange event-handler but afterwards
results in a nice RequestDone.

As Francois stated: don't Abort from within the event handlers.

Francois, what is the best way to handle this one? I can set a 'flag' within
the LocationChange handler and use it to Abort the client at a later moment
(or discard its content etc). I've also seen people talk about using
PostMessage but I'm not sure how to do that. How would I create a message
and use a handle for the processing object? (my own 'download-manager'
object for instance).

One more thing. In my application, this example never generates a
RequestDone and needs to be Aborted during a timeout check. The first
Relocation occurs but not the second. When I use HttpTst however the
location changes follow-through until the RequestDone. I have
FollowRelocation set to 'true' in my app so that shouldn't be the problem. I
do use Get Asynch however instead of Get like HttpTst does.



On 3/14/06, Merijn Terheggen <[EMAIL PROTECTED]> wrote:
> Are you sure? I experimented with ICS.HttpCli and used the OnRequestDone
> event to set flags for further download decisions. I use a timeout check and
> abort clients that take too long. However, I experienced certain clients
> never getting to OnRequestDone. That could very well be in aborted cases.
> How would one ever be sure no OnRequestDone event will be generated after
> abort? Use a timeout on the RequestDone event starting to count from the
> abort on? Doesn't sound very elegant...
> Regards, Merijn
> On 2/20/06, Tibor Csonka <[EMAIL PROTECTED]> wrote:
> >
> > As far as I know WaitForSingle(/Multiple)Object will block your thread,
> > and if you are working with a single thread that means it will block you
> > main thread indefinitely because once blocked you cannot set events or
> > semnalize semaphores etc..
> >
> > There are some cases in which OnRequestDone is not called if you're
> > aborting your request. As far as I remember if you are aborting on DNS
> > lookup or before any connection has been made are cases when it is not
> > sure that the event will fire. I've had hard time solving this kinds of
> > problems. A thing which I can tell that you that you should experiment
> > as much as possible with the reproduction of your bug and try to come up
> >
> > with a solution which will fit your needs best. Try to debug your code
> > and HttpCli code.
> >
> > regards,
> > Tibor
> >
> > Paul wrote:
> > >> Which error code do you get ?
> > >>
> > >
> > > Always hard to tell : I get the information from someone on the planet
> > :-(
> > > I've tried to simulate it here, but no luck so far.
> > >
> > > Does the Abort method works immediately or is it better to destroy and
> > > recreate the component ?
> > >
> > >
> > >> It is probably a good idea to wait a few seconds before retrying.
> > >>
> > > Using sleep or using WaitForSingleObject/WaitForMultipleObjects ?
> > > In other words : may this be a blocking or non-blocking wait?
> > >
> > >
> > > Paul
> > >
> > >
> > --
> > 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