curl-library
Connect-timeout on Win32
Date: Tue, 10 Feb 2004 18:16:12 +0100
As promised here is a patch to make CURLOPT_CONNECTTIMEOUT
and CURLOPT_TIMEOUT work for Curl_resolve() on Windows; A trace
after my patch:
> curl -v --connect-timeout 2 http://www.none.yet
1330: not yet
1286: gethostbyname_thread() retval FFFFFFFF, elapsed 2000 ms
* Resolving host timed out: www.none.yet
> dnsflush
> curl -v --connect-timeout 100 http://www.none.yet
1330: not yet
1202: Winsock-error 11001, addr unknown
1277: status 0, thread-status
1286: gethostbyname_thread() retval 00000000, elapsed 5219 ms
* Could not resolve host: www.none.yet (code 11001)
I.e. 5.2 sec is the Winsock default and 11001=HOST_NOT_FOUND
The patch doesn't do anything for IPv6 or Ares or CygWin (assuming
that alarm() works for CygWin).
Built and tested with MSVC-6 and gcc/MingW. Tested with telnet, dict,
http, https and ftp. It took me some time to understand the hairy structures
and actions in hostip.c, so hope I didn't break anything. The trace_it()
function can be removed unless someone finds some problem with the code.
--gv
- application/octet-stream attachment: diffs.async-windows