cURL / Mailing Lists / curl-library / Single Mail

curl-library

Change Request

From: Keean Schupke <keean_at_fry-it.com>
Date: Mon, 7 Feb 2011 11:26:12 +0000

Hi,

I am working on TCP tunnelling, and want to use libcurl for HTTP over the
tunnel. I can establish the tunnel in the OPENSOCKETFUNCTION callback, but
curl will fail with an error when it tries to connect the socket I have
returned (because it is already connected).

The OPENSOCKETFUNCTION already has access to all the information it needs to
establish the tunnel, so all I need is for curl to use the already connected
socket.

With a small change to lib/connect.c:

919c919
< if(conn->socktype == SOCK_STREAM)

---
>   if(conn->socktype == SOCK_STREAM) {
921c921,924
<   else
---
>     if ((rc == -1) && (SOCKERRNO == EISCONN)) {
>         rc = 0;
>     }
>   } else {
922a926
>   }
Which makes it ignore only the specific (EISCONN) error, I can do everything
I want using the OPENSOCKETFUNCTION.
I would like to get this change, or something similar that allows
OPENSOCKETFUNCTION to return an already connected socket accepted into the
libcurl source code.
Is this patch acceptable as it is, or if not, is there a better way to do
this that would be accepted. I think the ability to tunnel the HTTP
connection is useful and generic enough, and only requires a small
modification as most of the functionality required is already provided by
the OPENSOCKETFUNCTION callback.
Regards,
Keean Schupke.

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2011-02-07