cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Error buffer with multi interface

From: Martin C. Martin <martin_at_metahuman.org>
Date: Tue, 11 Mar 2003 09:03:56 -0500

Daniel Stenberg wrote:
>
> On Mon, 10 Mar 2003, Martin C. Martin wrote:
>
> > > Nope. The expected behaviour is to *always* supply a human readable error
> > > text when an error is returned. This is a bug.
> >
> > So, um, are you going to fix it or am I?
>
> I'll appreciate if you can have a look at it.

Ok, in connect.c, Curl_is_connected(), look for the comment:

/* nope, not connected for real */

Replace everything from that (inclusive) to the comment before the final
return (not inclusive) with:

    /* nope, not connected for real */
    if(err) {
      failf(data, "socket error: %d", err);
      return CURLE_COULDNT_CONNECT;
    }
  } else if (1 != rc) {
    int error = geterrno();
    failf(data, "Failed connect to %s: errno %d", conn->hostname, error);
    return CURLE_COULDNT_CONNECT;
  }

Note that the "if (err)" isn't really needed, since if err == 0 the if
statement just above is taken and returns from the function.

On Windows the errno isn't very helpful; if there's no server on that port
you get the error " A non-blocking socket operation could not be completed
immediately."

Now that I think about it, maybe the port number should be included in the
error message?

- Martin

-------------------------------------------------------
This SF.net email is sponsored by:Crypto Challenge is now open!
Get cracking and register here for some mind boggling fun and
the chance of winning an Apple iPod:
http://ads.sourceforge.net/cgi-bin/redirect.pl?thaw0031en
Received on 2003-03-11