cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Using libCurl over SSH Tunnel

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Mon, 12 Apr 2010 17:45:55 +0200 (CEST)

On Mon, 12 Apr 2010, Jérôme Patey wrote:

>> So why not setup the tunnel first, independently, and then just invoke
>> libcurl "as usual" over that tunnel? There's no need to touch libcurl code
>> to enable that.
>
> Yes, that would be nice. But how can I do that ? The problem here is that
> libCurl uses directly "read/write" whereas I want it to call
> "my_write_func()" and "my_read_func()". Is there a way to do that ?

I was more thinking about you setting up a tunnel like:

  "ssh -L 8080:[remotehost]:80 [sshserver]"

and then you point libcurl to the site, as you would with curl like:

  curl -H "Host: [remotehost]" http://localhost:8080/[rest of url]

> I think Curl_write is a little to highlevel, because the HTTPS protocol is
> done under this, right ? I should aim at sread and swrite then... but also
> socket, connect.
>
> The way to get a "SSH tunnel socket" is "libssh2_channel_something()", and
> it returns a libssh2 socket. Then, there are functions like
> libssh2_write()/read().

Right, if you want to completely make SSH act as a proxy, then I think a good
plan is to see how the socks code is done and handled. It needs to first
connect to the proxy and then all read/writes to the proxy are taken care of
especially based on the proxy selection.

In my view, it would make an interesting addition...

-- 
  / daniel.haxx.se

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2010-04-12