cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Implementing protocols with curl sockets

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Thu, 30 Apr 2009 00:09:32 +0200 (CEST)

On Wed, 29 Apr 2009, Roman Kubiak wrote:

> The question is how can i pass a connected, proxy aware socket to libssh2
> using curl. I mean i want a connected socket but not to the proxy only but
> to the end host, with all the proxy stuff done.

Well, you then need proxytunnel or similar enabled since a proxy by definition
is terminating the connection a client makes, and the proxy then makes the
rest of the communication for the client to the remote server.

> I thought of using the http protocol but i dn't think i can force curl
> to zero all sent data

You shouldn't allow libcurl to send anything, use CURLOPT_CONNECT_ONLY,
CURLOPT_HTTPPROXYTUNNEL and then curl_easy_getinfo()'s CURLINFO_LASTSOCKET.

> Perhaps you could expose the libssh2 session handles with curl_getinfo() so
> that i can use that to do some nasty stuff.

Uhm, yeah that would be an alternative. To allow CURLOPT_CONNECT_ONLY with SCP
or SFTP and then have a feature similar to CURLINFO_LASTSOCKET that instead
returns the libssh2 session handle. But I'm really not liking the thought of
having that ability in the API. I think it's bad enough already that we can
export the "raw" socket like this...

-- 
  / daniel.haxx.se
Received on 2009-04-30