Re: Retrieving the local address between connect() and HTTP
Date: Mon, 27 Apr 2020 04:41:27 +0200
On 4/26/2020 4:44 PM, Jean-Francois Dockes wrote:
>> Thanks for the CURLOPT_CONNECT_ONLY pointer.
>>
>> Is there something to prevent me from using the resulting socket fd with
>> CURLOPT_OPENSOCKETFUNCTION / CURLOPT_SOCKOPTFUNCTION ? I see that
>> this is a
>> bit convoluted, but it gains me the use of the libcurl URL parsing and
>> connect code instead of DIY. Does it make sense ? Performance is no big
>> issue in my use case.
Since you are not sensible on performance, I wrote a working example
that does the job in 2 phases: 1 for the connect and 2 for the HTTP
protocol, reusing the socket descriptor from 1. It is then possible to
get the local address between the 2 phases. As it uses
CURLOPT_CONNECT_ONLY, connection reuse does not apply.
Please find it in attachment.
-------------------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library
Etiquette: https://curl.haxx.se/mail/etiquette.html
- text/x-csrc attachment: transmitlocaladdress.c