curl / Mailing Lists / curl-library / Single Mail
Buy commercial curl support from WolfSSL. We help you work out your issues, debug your libcurl applications, use the API, port to new platforms, add new features and more. With a team lead by the curl founder himself.

Re: conn.data considered bad

From: Daniel Stenberg via curl-library <curl-library_at_cool.haxx.se>
Date: Tue, 26 Jan 2021 16:05:35 +0100 (CET)

On Fri, 8 Jan 2021, Daniel Stenberg via curl-library wrote:

> Status: there are 939 current uses of this pointer

We're down to 40 references left and I'm going to let the last few ones remain
over this next release and remove the pointer from the connectdata struct
completely in the beginining of the next release cycle.

There are two somewhat complicated changes left:

  - OpenSSL: https://github.com/curl/curl/pull/6522

The OpenSSL logging callback is set per connection context and we set a
callback argument that is a 'connectdata *' now. I tried to change this to
'Curl_easy *' and update it as soon as we use OpenSSL, but we could then end
up with getting the wrong pointer passed to the callback, possibly because
OpenSSL stores the pointer before we update it. So we need to invent a
work-around. 'conn->data' like, but for OpenSSL private use.

  - HTTP/2: https://github.com/curl/curl/pull/6520

Very similar to the OpenSSL problem, we set callbacks and a context argument
that is bound to the connection. We cannot set a 'Curl_easy *' there becaused
we don't have that function universally, and we probably risk the same problem
as I saw in the OpenSSL case. A work-around is provided. 'conn->data' like,
but for nghttp2 private use.

Once those two have landed the remaining few should be easy to fix.

Thanks a bunch to Patrick Monnerat who helped a lot on this rather major
refactor.

log of some of the changes we've done:
https://github.com/curl/curl/wiki/conn.data-considered-bad

-- 
  / daniel.haxx.se
  | Commercial curl support up to 24x7 is available!
  | Private help, bug fixes, support, ports, new features
  | https://www.wolfssl.com/contact/
-------------------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library
Etiquette:   https://curl.se/mail/etiquette.html
Received on 2021-01-26