cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Passing raw data through a proxy

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Mon, 16 Jan 2006 10:07:56 +0100 (CET)

On Mon, 16 Jan 2006, Allen Chan wrote:

>> 2 - CURLINFO_LOCAL_PORT. As Karl M pointed out, what's the point of having
>> libcurl do getsockname() on the socket when your app simply can first
>> extract the socket and then do getsockname() on it on its own? Are there
>> really situations when you want to extract the local port only without
>> getting the socket/connection ?
>
> Getting the port can really be simply isn't it. But I thought I was trying
> to make it easier on the programmer (someone may not know how to do it?) and
> atleast maybe round out the features.

I find that very unlikely. The person who'd want to extract the local port
number would need that number for a reason to start with, and if you'd
understand that much I find it likely that you'd also know about such simple
things as how to read that out from a socket.

But sure, if you think it makes life easier for you then we can leave it like
this, it is so very little extra code and complexity.

>> It needs a somewhat more robust handling and I already suggested that it
>> could be made by having the SessionHandle struct keep info about the most
>> recently used connection or similar.
>
> Ah yes, now I understand. I can make those changes. Do you think that we can
> store the socket handle on connection? I'm hoping its not on access since
> there would be alot of entry points. Meaning, the last connected socket
> whether succesful or not.

I'm not sure what you're asking.

The lib/url.c:Curl_done() function gets called when a single request has
completed. In there you also see that the connection is sometimes closed and
the connectdata struct is killed at this time.

In that function you could simply store a pointer (most likely in the struct
UrlState part of the SessionHandle struct) to the connectdata struct if the
connection is still alive, or set it to NULL if not and then rely on that
pointer to hold the truth when you extract the socket later...

Also, as I forgot in my last response, please update the documentation
accordingly for your new features. Edit the nroff files (with a .3 extension)
and include the changes in your patch. Just follow the syntax already used and
you should have no trouble.

-- 
  Commercial curl and libcurl Technical Support: http://haxx.se/curl.html
Received on 2006-01-16