curl / Mailing Lists / curl-library / Single Mail

curl-library

Re: Wrong connection reuse - curl_easy_send/recv with curl_multi

From: Daniel Stenberg via curl-library <curl-library_at_cool.haxx.se>
Date: Sat, 16 Feb 2019 16:11:00 +0100 (CET)

On Thu, 14 Feb 2019, Pavel Löbl via curl-library wrote:

> I want to use CURLOPT_CONNECT_ONLY/CURLINFO_ACTIVESOCKET with
> curl_easy_send/recv to implement custom protocol using curl multi interface.
>
> I have multiple connections to the same host (behind a proxy). One of them
> is marked with CURLOPT_CONNECT_ONLY. This one I want to use for custom
> protocol traffic. However when another usual http request is made curl will
> reuse the previous "connect only" connection. Thus blocking me from using it
> for custom stuff.
>
> If I add CURLOPT_FORBID_REUSE it is closed immediately after connect.
>
> It just seems curl considers the connection as finished and ready to be
> reused which is not true for curl_easy_send/recv use case.

CURLOPT_CONNECT_ONLY connections should never be reused, period. By handing
over the control of the connection to "outsiders" makes it impossible to do
reliably (because curl no longer knows what was sent/received or the state of
it). I think that if such a connection is considered for reuse as you say it
is, that's a bug.

Can you help us write up an example that reproduces this?

-- 
  / daniel.haxx.se

-------------------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library
Etiquette: https://curl.haxx.se/mail/etiquette.html
Received on 2019-02-16