cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Using libCurl over SSH Tunnel

From: Jérôme Patey <jerome_at_patey.net>
Date: Mon, 12 Apr 2010 17:03:11 +0200

Hi,

Thanks for your answer

On Mon, 12 Apr 2010 16:46:31 +0200 (CEST), Daniel Stenberg
<daniel_at_haxx.se>
wrote:
> On Mon, 12 Apr 2010, Jérôme Patey wrote:
>
>> I wanted to use libCurl over a SSH proxy. That is, I connect to the
>> remove
>> server using SSH, then create a tunnel, and I want to use the resulting

>> socket in libCurl.
>
> 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 ?

>
>> libCurl gurus, do you know which function of libCurl I can override so
>> that
>> all read/write on the socket go through my functions ?
>
> There's been talk in the past of making these functions customizable to
> allow
> applications to replace them easily, but nothing has come out from those

> discussions (yet).
>
> The functions you're looking for are probably (a little depending on at
> which
> level you're aiming to support this):
>
> 1 - Curl_write and Curl_read
>
> or
>
> 2 - sread and swrite (those are defines)

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().

Thanks,
Jerome

-- 
Jérôme Patey - jerome_at_patey.net
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html
Received on 2010-04-12