-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Take const CURLU* arg in URL observers #10708
Conversation
This is unintuitive, and prevents const usage.
Can you elaborate on this. When or how would it "mutate" its input? |
See the second commit: it modifies the The latter seems like an outright bug; see the output from this test program, linked against the current code:
The function escapes percent signs in |
That "mutation" is a bug. |
Makes sense; so, this PR fixes that bug, and also makes it more difficult for similar bugs to recur in the future. |
Thinking further, I believe |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For all I can tell, adding const
like this should be fine both API and ABI wise.
Update test 1560 to verify Ref: #10708
Thanks! |
Update test 1560 to verify Ref: curl#10708 Closes curl#10711
This was not intended. Closes curl#10708
Currently,
curl_url_dup
andcurl_url_get
each take a non-constCURLU*
arg. In the case of_dup
, there seems to be no reason for this; it never actually mutates the input.curl_url_get
, though, actually can mutate its input; this is unintuitive and undocumented. This PR ensures that_get
never mutates its input (this is a fairly trivial set of changes), and changes the arg type for those two functions toconst CURLU*
.This changes the signatures for two public functions, but the result is both API- and ABI-compatible with existing code, so it shouldn't require a major semver bump.
If this change is rejected for some reason, the documentation should be updated to clearly indicate that
curl_url_get
can mutate its input.