async win32: infinite event loop on connect to closed http server

hi,

if i try any provided libwww sample with a http server address of an
existing network machine that doesn't run a service on a particular tcp
service port, all samples programs hang forever.
How do I set a timeout/handler/maxRetryValue that the lib doesn’t try to
connect forever???

For example with sample "LoadToFile":

working example with an existing host:

LoadToFile http://www.w3.org -o w3chome.html
Looking up www.w3.org
Looking up www.w3.org
Contacting www.w3.org
Reading...
Read (3% of 26K)
....
Read (98% of 26K)
Done!



working example that program/lib detects that the host doesn't exist and
looking up the hostname failed:

LoadToFile http://doesnotexist -o w3chome.html
Looking up doesnotexist
Looking up doesnotexist
Fatal Error: Can't locate remote host (doesnotexist)
Reason: gethostbyname operation failed (WinSock reported error=11001)


example that hangs in an infinite loop, the host exists but doesn't run
a service on port 81:

LoadToFile http://www.w3.org:81 -o w3chome.html
Looking up www.w3.org
Looking up www.w3.org
Contacting www.w3.org
(after that the program hangs forever, like all other sample programs)

I had a look into the source, the progam doesn't leave the
HTEventList_loop() function (HTEvtLst.c) and the EventListTimerHandler()
complains every few seconds that "Event....... No event for timer 0x...
with context 0x..." (HTEvent_TIMEOUT).


regards
Tobias



trace:

Net After... Add 00401000 with order 65535 tmplate `<null>' code 1
context 00000
000
Host........ Setting event timeout to 10000 ms
Request..... Created 00933150
Memory Free. 00933330
Memory Free. 009332E8
Memory Free. 00933298
Memory Free. 009332E8
HTSimplify.. `http://www.w3.org:81' into
............. `http://www.w3.org:81'
Find Parent. 00933CA8 with hash 350 and address `http://www.w3.org:81'
created
HTAccess.... Accessing document http://www.w3.org:81
Memory Free. 00933D98
Net Before.. calling 1000285E (request 00933150, context 00000000)
Check rules. for `http://www.w3.org:81'
Memory Free. 00933D98
Net Before.. calling 10002864 (request 00933150, context 00000000)
Auth Engine. Looking up `http://www.w3.org:81'
Memory Free. 00933EC0
Memory Free. 00933E78
Memory Free. 00933E28
URL Tree.... did NOT find `w3c-AA'
Memory Free. 00933E78
Auth Engine. No information
Memory Free. 00933D98
Credentials. verified
Net Before.. calling 100027DA (request 00933150, context 00000000)
PEP Engine.. Looking for info on `http://www.w3.org:81'
Memory Free. 00934078
Memory Free. 00933D98
Memory Free. 00933E60
URL Tree.... did NOT find `w3c-pep'
Memory Free. 00933D98
PEP Engine.. No information
Net Before.. calling 10002858 (request 00933150, context 00000000)
Memory Free. 00934078
Memory Free. 00933D98
Memory Free. 00933E60
Memory Free. 00933D98
Net Object.. 00934078 created with hash 0
Net Object.. starting request 00933150 (retry=1) with net object
00934078
HTTP........ Looking for `http://www.w3.org:81'
Memory Free. 00934B68
Memory Free. 00934B20
Memory Free. 00934AD0
HTHost parse Looking up `www.w3.org' on port 81
Event....... Created event 00934DB8 with context 00934C98, priority 20,
and timeout 10000
Event....... Created event 00934DF8 with context 00934C98, priority 20,
and timeout 10000
Event....... Created event 00934E38 with context 00934C98, priority 20,
and timeout 10000
Event....... Created event 00934E78 with context 00934C98, priority 20,
and timeout 10000
Event....... Created event 00934EB8 with context 00934C98, priority 20,
and timeout 10000
Event....... Created event 00934EF8 with context 00934C98, priority 20,
and timeout 10000
Host info... added `www.w3.org' with host 00934C98 to list 00934AD0
Memory Free. 00934B20
Host connect Grabbing lock on Host 00934C98 with 00934078
Host info... Added Net 00934078 (request 00933150) to pipe on Host
00934C98, 1 r
equests made, 1 requests in pipe, 0 pending
HTHost...... No ActivateRequest callback handler registered
HTHost 00934C98 going to state TCP_CHANNEL.
HTHost 00934C98 going to state TCP_DNS.
Looking up www.w3.org
Memory Free. 00935118
Looking up www.w3.org
Memory Free. 00935118
DNS Add..... `www.w3.org' with 3 home(s) to 009350E0
ParseInet... as port 81 on 18.7.14.127 with 3 homes
HTHost 00934C98 going to state TCP_NEED_SOCKET.
Socket...... Created 664
Net Manager. Increasing active sockets to 1, 0 persistent sockets
Socket...... Turned off Nagle's algorithm
Socket...... Non-blocking socket
Channel..... Hash value is 61
Channel..... Added 009364F0 to list 009364B8
Reader...... Created reader stream 00936580
Socket...... TCP send buffer size is 8192 for socket 664
Contacting www.w3.org
Memory Free. 00940690
HTHost 00934C98 going to state TCP_NEED_CONNECT.
Event....... Register socket 664, request 00000000 handler 00298870 type
HTEvent_CLOSE at priority 20
Event....... Registering socket for HTEvent_CLOSE
Timer....... Created repetitive timer 00940850 with callback 003046C0,
context 009406C8, and relative timeout 10000
Event....... Register socket 664, request 00933150 handler 00298870 type
HTEvent_CONNECT at priority 20
Event....... Registering socket for HTEvent_CONNECT
Timer....... Created repetitive timer 009408D0 with callback 003046C0,
context 009406C8, and relative timeout 10000
HTDoConnect. WOULD BLOCK `www.w3.org'
Memory Free. 00940918
Timer....... Found timer 009408D0 with callback 003046C0, context
009406C8, and relative timeout 10000
Timer....... Dispatch timer 009408D0
Event....... No event for timer 009408D0 with context 009406C8
Memory Free. 00940898
Timer....... Found timer 00940850 with callback 003046C0, context
009406C8, and relative timeout 10000
Timer....... Dispatch timer 00940850
Event....... No event for timer 00940850 with context 009406C8
Memory Free. 00940898

Received on Wednesday, 25 August 2004 08:58:39 UTC