Re: Callback for socket options in curl + c-ares
Hi folks, I went ahead and created a patch to provide a new libcurl CB, that will be called just before a new resolver is called, and the resolver data (channel in case of cares) is passed. This solves the problem perfectly for my use case. Initially I thought about just adding a new easy_getinfo option to retrieve it, but since libcurl can create easy_handles on it's own, I feel this callback approach is a safer option. Are you guys OK with that approach? If that's ok I can send the pull request for review. Thanks, . .:|:.:|:. Francisco Sedano | CCIE 14859, Tech Lead Software Engineering | CSG Enterprise Access and Services Group (EASG) On 14.02.18, 00:54, "curl-library on behalf of Francisco Sedano Crippa (fsedanoc)" wrote: Hello Daniel, I feel it would be useful in some other cases - for example dealing with multi-vrf sockets, currently you can bind the libcurl socket to any vrf you want, but no way to do that with the underlying c-ares. Wouldn't be enough to provide access to the c-ares channel (which is in curl_easy->state.resolver if I'm not wrong)? Once I create my easy socket and the c-ares channel is created, I could just use ares_set_socket_configure_callback on the channel and I'd be done. Anything else I'm missing? Thanks, . .:|:.:|:. Francisco Sedano | CCIE 14859, Tech Lead Software Engineering | CSG Enterprise Access and Services Group (EASG) On 13.02.18, 23:49, "curl-library on behalf of Daniel Stenberg" wrote: On Tue, 13 Feb 2018, Francisco Sedano Crippa (fsedanoc) wrote: > Ideally I’d like to setup a callback with > ares_set_socket_configure_callback(), but in order to do so, I need access > to internal libcurl c-ares channel, which is embedded in the Curl_easy > structure. > > Is there any way to access such c-ares channel so I can properly intercept > c-ares socket usage, like we can do with CURLOPT_OPENSOCKETFUNCTION in > libcurl? No, that's something we've not felt the need for before... I can't think of any other way to offer such a feature than to add a special and dedicated "set socket options" callback for c-ares or perhaps rather for "the resolver back-end". (There's work ongoing in making the resolver back-end totally pluggable which then possibly also appreciate such an ability.) -- / daniel.haxx.se --- Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library Etiquette: https://curl.haxx.se/mail/etiquette.html --- Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library Etiquette: https://curl.haxx.se/mail/etiquette.html
Re: Callback for socket options in curl + c-ares
Hello Daniel, I feel it would be useful in some other cases - for example dealing with multi-vrf sockets, currently you can bind the libcurl socket to any vrf you want, but no way to do that with the underlying c-ares. Wouldn't be enough to provide access to the c-ares channel (which is in curl_easy->state.resolver if I'm not wrong)? Once I create my easy socket and the c-ares channel is created, I could just use ares_set_socket_configure_callback on the channel and I'd be done. Anything else I'm missing? Thanks, . .:|:.:|:. Francisco Sedano | CCIE 14859, Tech Lead Software Engineering | CSG Enterprise Access and Services Group (EASG) On 13.02.18, 23:49, "curl-library on behalf of Daniel Stenberg" wrote: On Tue, 13 Feb 2018, Francisco Sedano Crippa (fsedanoc) wrote: > Ideally I’d like to setup a callback with > ares_set_socket_configure_callback(), but in order to do so, I need access > to internal libcurl c-ares channel, which is embedded in the Curl_easy > structure. > > Is there any way to access such c-ares channel so I can properly intercept > c-ares socket usage, like we can do with CURLOPT_OPENSOCKETFUNCTION in > libcurl? No, that's something we've not felt the need for before... I can't think of any other way to offer such a feature than to add a special and dedicated "set socket options" callback for c-ares or perhaps rather for "the resolver back-end". (There's work ongoing in making the resolver back-end totally pluggable which then possibly also appreciate such an ability.) -- / daniel.haxx.se --- Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library Etiquette: https://curl.haxx.se/mail/etiquette.html
Re: Callback for socket options in curl + c-ares
On Tue, 13 Feb 2018, Francisco Sedano Crippa (fsedanoc) wrote: Ideally I’d like to setup a callback with ares_set_socket_configure_callback(), but in order to do so, I need access to internal libcurl c-ares channel, which is embedded in the Curl_easy structure. Is there any way to access such c-ares channel so I can properly intercept c-ares socket usage, like we can do with CURLOPT_OPENSOCKETFUNCTION in libcurl? No, that's something we've not felt the need for before... I can't think of any other way to offer such a feature than to add a special and dedicated "set socket options" callback for c-ares or perhaps rather for "the resolver back-end". (There's work ongoing in making the resolver back-end totally pluggable which then possibly also appreciate such an ability.) -- / daniel.haxx.se--- Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library Etiquette: https://curl.haxx.se/mail/etiquette.html
Callback for socket options in curl + c-ares
Hello folks, In our environment, we need to setup some socket options before sockets can be used, and we need to use curl + c-ares. Ideally I’d like to setup a callback with ares_set_socket_configure_callback(), but in order to do so, I need access to internal libcurl c-ares channel, which is embedded in the Curl_easy structure. Is there any way to access such c-ares channel so I can properly intercept c-ares socket usage, like we can do with CURLOPT_OPENSOCKETFUNCTION in libcurl? Thanks! . .:|:.:|:. Francisco Sedano | CCIE 14859, Tech Lead Software Engineering | CSG Enterprise Access and Services Group (EASG) --- Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library Etiquette: https://curl.haxx.se/mail/etiquette.html