Skip to content

Add network_interface option to bind outgoing HTTP requests to a spec…#286

Open
mmarwah wants to merge 1 commit intobabelouest:masterfrom
mmarwah:master
Open

Add network_interface option to bind outgoing HTTP requests to a spec…#286
mmarwah wants to merge 1 commit intobabelouest:masterfrom
mmarwah:master

Conversation

@mmarwah
Copy link
Copy Markdown

@mmarwah mmarwah commented Apr 20, 2026

Summary

  • Adds char * network_interface field to struct _u_request in ulfius.h, allowing callers to bind outgoing HTTP requests to a specific network interface or IP address (via libcurl's CURLOPT_INTERFACE)
  • Initializes the field to NULL in ulfius_init_request, frees and nulls it in ulfius_clean_request, and deep-copies it in ulfius_copy_request
  • In ulfius_send_http_request, sets CURLOPT_INTERFACE on the curl handle when network_interface is non-NULL, with appropriate error logging on failure

Comment thread src/u_request.c
o_free(request->http_url);
o_free(request->url_path);
o_free(request->proxy);
o_free(request->network_interface);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Null check is not required before free?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@babelouest
Copy link
Copy Markdown
Owner

Hello,

Although I understand the need, I'm not sure it's a good idea to add libcurl options that are not "mainstream". My future self would have difficulties to maintain too much options that are not used so much...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants