lib: move request specific allocations to the request struct#21301
Closed
bagder wants to merge 3 commits into
Closed
lib: move request specific allocations to the request struct#21301bagder wants to merge 3 commits into
bagder wants to merge 3 commits into
Conversation
Member
Author
🔒 Aisle Security Analysis✅ We scanned this PR and did not find any security vulnerabilities. Aisle supplements but does not replace security review. Analyzed PR: #21301 at commit Last updated on: 2026-04-13T17:47:59Z |
There was a problem hiding this comment.
Pull request overview
This PR moves per-request HTTP auth header allocations (userpwd / proxyuserpwd) from the long-lived UrlState storage into the request-scoped SingleRequest struct to better reflect their ephemeral nature.
Changes:
- Relocated
userpwdandproxyuserpwdfields fromdata->state.aptrtodata->req. - Updated HTTP/RTSP/auth/proxy code paths to read/write the auth header strings via
data->req.*. - Adjusted cleanup paths to free the relocated allocations on handle close.
Reviewed changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| lib/urldata.h | Removes userpwd/proxyuserpwd from UrlState dynamic allocations. |
| lib/request.h | Adds userpwd/proxyuserpwd to struct SingleRequest. |
| lib/url.c | Frees the moved request-scoped auth header allocations during Curl_close(). |
| lib/http.c | Uses data->req.* for Basic/Bearer auth headers and when adding auth headers to requests; clears at end of Curl_http(). |
| lib/http_proxy.c | Uses data->req.proxyuserpwd when building CONNECT requests. |
| lib/http_ntlm.c | Points NTLM auth header allocation at data->req.*. |
| lib/http_negotiate.c | Stores Negotiate auth header into data->req.*. |
| lib/http_digest.c | Points Digest auth header allocation at data->req.*. |
| lib/http_aws_sigv4.c | Stores SigV4 Authorization header into data->req.userpwd. |
| lib/rtsp.c | Switches RTSP auth header usage/freeing to data->req.userpwd / data->req.proxyuserpwd. |
| lib/cf-h1-proxy.c | Clears proxy auth header via data->req.proxyuserpwd in proxy tunnel state machine. |
| lib/cf-h2-proxy.c | Clears proxy auth header via data->req.proxyuserpwd in proxy tunnel state machine. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
To make it clearer that they are ephemeral.
d434bfb to
59e1a85
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
To make it clearer that they are ephemeral.