Repository navigation
getinfo: clarify invalid URL handling for CURLINFO_EFFECTIVE_URL - #23444
Closed
mszabo-wikia wants to merge 1 commit into
Closed
mszabo-wikia wants to merge 1 commit into
mszabo-wikia wants to merge 1 commit into
Conversation
mszabo-wikia
commented
Oct 16, 2026
|
|
||
| if(uc || !url) | ||
| return CURLE_OUT_OF_MEMORY; | ||
| return uc ? Curl_uc_to_curlcode(uc) : CURLE_OUT_OF_MEMORY; |
Contributor
Author
There was a problem hiding this comment.
I'm admittedly not 100% certain about whether to change the return code here, happy to leave it as-is and just keep the docfix
Since 7a6bd02 `CURLINFO_EFFECTIVE_URL` returns `CURLE_OUT_OF_MEMORY` if the effective URL couldn't be parsed, which surprised some code that expected it to be mostly always present in normal operation (we interact with `libcurl` over HHVM's wrapper, which, akin to PHP, wraps[1] easy_getinfo and returns a dict with optional entries, so it's been easy for things to assume that `url` would always be set). Clarify the new behaviour in docs and have `CURLINFO_EFFECTIVE_URL` return the relevant parsing error code rather than `CURLE_OUT_OF_MEMORY` for invalid URLs. [1] https://github.com/facebook/hhvm/blob/c83584cad90cc9327d0b75175135d46882d8dc1f/hphp/runtime/ext/curl/ext_curl.cpp#L208
mszabo-wikia
force-pushed
the
doc-effective-url
branch
from
October 16, 2026 21:00
871df1a to
ed28b80
Compare
There was a problem hiding this comment.
🟢 Approval recommended
The localized changes include matching documentation and regression coverage, with no identified blocking issues.
No open issues 🎉
What changed in this PR
Clarifies how libcurl reports invalid effective URLs while preventing unfiltered URLs from being returned on failure.
Changes:
- Returns the relevant URL parsing error and sets the output pointer to NULL.
- Documents credential removal and empty or invalid URL behavior.
- Adds regression coverage for unused handles and malformed URLs containing credentials.
| File | Description |
|---|---|
| tests/libtest/Makefile.inc | Registers the new test source. |
| tests/libtest/lib1990.c | Exercises empty and malformed effective URLs. |
| tests/data/test1990 | Defines expected output and error codes. |
| tests/data/Makefile.am | Registers the test case. |
| lib/getinfo.c | Corrects error mapping and output-pointer handling. |
| docs/libcurl/opts/CURLINFO_EFFECTIVE_URL.md | Documents effective URL return behavior. |
Review effort: Balanced
bagder
approved these changes
Oct 17, 2026
Member
|
Thanks! |
Contributor
Author
|
Thanks for the quick review! |
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.
Since 7a6bd02
CURLINFO_EFFECTIVE_URLreturnsCURLE_OUT_OF_MEMORYif the effective URL couldn't be parsed, which surprised some code that expected it to be mostly always present in normal operation (we interact withlibcurlover HHVM's wrapper, which, akin to PHP, wraps[1] easy_getinfo and returns a dict with optional entries, so it's been easy for things to assume thaturlwould always be set).Clarify the new behaviour in docs and have
CURLINFO_EFFECTIVE_URLreturn the relevant parsing error code rather thanCURLE_OUT_OF_MEMORYfor invalid URLs.[1] https://github.com/facebook/hhvm/blob/c83584cad90cc9327d0b75175135d46882d8dc1f/hphp/runtime/ext/curl/ext_curl.cpp#L208