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.

Inherit CURLOPT_SOCKOPTFUNCTION (and DATA) for DoH ?

From: Magnus Röös via curl-library <curl-library_at_lists.haxx.se>
Date: Thu, 17 Aug 2023 09:07:01 +0200

Hello,

I can't find anything doing setsockopt on the DoH socket. Would it
make sense to do something like this? Or would it make things worse? The
reason is I'm trying to do policy based routing by setting mark/tos on
requests. So I want everything from libcurl to go through the same routing
rules. Or is there a reason for not doing it at all?

This is untested code, and mostly there for discussion. If it makes sense I
could do a proper pull request, or if there is a will for a separate opt I
could do that too.

Regards,

Magnus Röös

diff --git a/lib/doh.c b/lib/doh.c
index 7a38eab01..57d76ddb6 100644
--- a/lib/doh.c
+++ b/lib/doh.c
_at__at_ -267,6 +267,10 _at__at_ static CURLcode dohprobe(struct Curl_easy *data,
       ERROR_CHECK_SETOPT(CURLOPT_VERBOSE, 1L);
     if(data->set.no_signal)
       ERROR_CHECK_SETOPT(CURLOPT_NOSIGNAL, 1L);
+ if(data->set.fsockopt)
+ ERROR_CHECK_SETOPT(CURLOPT_SOCKOPTFUNCTION, data->set.fsockopt);
+ if(data->set.sockopt_client)
+ ERROR_CHECK_SETOPT(CURLOPT_SOCKOPTDATA, data->set.sockopt_client);

     ERROR_CHECK_SETOPT(CURLOPT_SSL_VERIFYHOST,
       data->set.doh_verifyhost ? 2L : 0L);


-- 
Unsubscribe: https://lists.haxx.se/mailman/listinfo/curl-library
Etiquette:   https://curl.se/mail/etiquette.html
Received on 2023-08-17