AW: problem with HTEvent_loop function

Hello Hu,

you wrote:

> hi
> I am new to here. I am using libwww-5.3.2 under redhat linux 7.0.
> 
> I am trying to modify Library/Examples/postform.c as a function
>  so i can call in my program.I want use the result of a POST.
>  It's quite easy, but the problem I meet is when postform 
> returns, the program exits too. It happens in HTEvent_loop, this
>  function never returns, anything i could do to prevent this happen?

Look at terminate_handler(), it does a HTProfile_delete() and exit(0) after
the first request.
Remove these and put in a "return status;" and it should be fine.

But then there is another thing, I think this is what's happening (if not,
everybody please correct me): The socket is kept alive so that it can be
reused if another request to the same server is done. As long as it hasn't
timed out, HTEventList_loop() won't return.

We tried to put a HTEventList_stopLoop() as seen in chunkbody.c at the end
of terminate_handler(),
but this crashed with access violations on our NT systems.
This seems to be a bug though and only happens when WWW_WIN_ASYNC is not
#defined, so you should try to stop the loop first as you are running on
Linux. (We can't have WWW_WIN_ASYNC because then libwww won't work if IE 5.5
is on the system, see my older messages to this list.)
Just for the records, we disable connection-keep-alive with
HTRequest_addConnection(pHTRequest, "close", ""); so the event loop will end
after the request has completed.

But there is the little problem that, when a request times out because the
server is unreachable, the event loop will continue to run for about 20s
after our after filter has been called, which is a waste of time that we
want to remove.
But this probably means to get HTEventList_stopLoop() to work properly in
our environment.

Hope this helps,

Markus

Received on Friday, 30 March 2001 06:43:22 UTC