Skip to content

ssl: dedup ssl_fsslctx - #22876

Closed
icing wants to merge 1 commit into
curl:masterfrom
icing:ssl-dedup-fsslctx
Closed

icing wants to merge 1 commit into
curl:masterfrom
icing:ssl-dedup-fsslctx

Conversation

@icing

@icing icing commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

The members fsslctx(p) in struct ssl_config_data were only set on data->set.ssl and never on data->set.proxy_ssl, yet were used from the first one in all TLS filters that support it.

Move the callback and its userdata outside the config struct, since we need it only once.

The members fsslctx(p) in `struct ssl_config_data` were only
set on `data->set.ssl` and never on `data->set.proxy_ssl`, yet
were used from the first one in all TLS filters that support it.

Move the callback and its userdata outside the config struct, since
we need it only once.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟢 Approval recommended

The refactor is narrowly scoped to internal storage/access of the SSL ctx callback and all in-repo references to the old fields appear consistently updated.

Pull request overview

This PR centralizes the CURLOPT_SSL_CTX_FUNCTION callback and its userdata so they’re stored only once on the easy handle, matching how the TLS backends actually use the callback (previously it lived inside set.ssl config but was effectively ignored for set.proxy_ssl).

Changes:

  • Move fsslctx / fsslctxp out of struct ssl_config_data and into struct UserDefined as ssl_fsslctx / ssl_fsslctxp.
  • Update OpenSSL, wolfSSL, and mbedTLS backends to use the deduplicated data->set.ssl_fsslctx(p) fields.
  • Update DoH option propagation and setopt handling to set/read the new fields.
File summaries
File Description
lib/vtls/wolfssl.c Switch SSL ctx callback invocation to data->set.ssl_fsslctx(p).
lib/vtls/vtls_config.h Remove SSL ctx callback members from struct ssl_config_data.
lib/vtls/openssl.c Switch SSL_CTX callback invocation to data->set.ssl_fsslctx(p).
lib/vtls/mbedtls.c Switch SSL config callback invocation to data->set.ssl_fsslctx(p).
lib/vdns/doh.c Propagate SSL ctx callback + userdata using the new data->set.ssl_fsslctx(p) fields.
lib/urldata.h Add ssl_fsslctx / ssl_fsslctxp to struct UserDefined.
lib/setopt.c Store CURLOPT_SSL_CTX_FUNCTION / CURLOPT_SSL_CTX_DATA into the new fields.
Review details
  • Files reviewed: 7/7 changed files
  • Comments generated: 1
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread lib/urldata.h
time_t timevalue; /* what time to compare with */
struct ssl_config_data ssl; /* user defined SSL stuff */
curl_ssl_ctx_callback ssl_fsslctx; /* function to initialize SSL ctx */
void *ssl_fsslctxp; /* parameter for call back */
@bagder bagder closed this in 19eec5f Sep 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants