cURL / Mailing Lists / curl-users / Single Mail

curl-users

nonblocking sockets (was: connect-timeouts)

From: Georg Horn <horn_at_koblenz-net.de>
Date: Fri, 4 Jan 2002 16:57:40 +0100

Hm, i made some experiments and it seems that openssl is not working
with nonblocking sockets... I first added a few fprintf()s to my
previously patched version and got the follwing behaviour:

> src/curl -v --connect-timeout 1 https://meine.db24.de
    doing dnslookup
    connecting
    socket nonblocking
    waiting for connection
    connected, socket blocking again
    calling protocol-specific connect function
    doing Curl_SSLConnect
    alarmfunc called
    * Closing connection #0
    curl: (35) SSL: error:00000000:lib(0):func(0):reason(0)

This confirms my guess, that the signal just hits us during ssl-stuff.
But when i comment out the line

    Curl_nonblock(sockfd, FALSE);

in connect.c, so that the socket stays non-blocking, it doesn't work at all:

> src/curl -v --connect-timeout 10 https://meine.db24.de
    doing dnslookup
    connecting
    socket nonblocking
    waiting for connection
    connected, socket still non-blocking
    calling protocol-specific connect function
    doing Curl_SSLConnect

Here it should display something like "* SSL connection using RC4-MD5"
etc, but it doesn't, and later on reports an error:

    * Connected to meine.db24.de (193.150.167.1)
> GET / HTTP/1.1
    User-Agent: curl/7.9.2 (i686-pc-linux-gnu) libcurl 7.9.2 (OpenSSL 0.9.6)
    Host: meine.db24.de
    Pragma: no-cache
    Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, */*

    curl: (23) SSL: error:00000000:lib(0):func(0):reason(0)
    * Closing connection #0

So there is some more work to be done. Unfortunately, i have no idea
how this ssl-stuff works, so i'll stay with the signal-solution for now...

Bye,
Georg
Received on 2002-01-04