URL reformatting issue with Requests_IRI
When requesting an URL with a fragment, the reformatted URL can be different from the original one. The following example rewrites https://example.com/#foobar to https://example.com#foobar instead of returning the same URL. As a consequence, curl fails to load the URL.
$url = "https://example.com/#foobar";
$iri = new Requests_IRI($url);
$url = $iri->uri;
var_dump($url);
The IRI parser is intended to return a different IRI, or rather, the "normalised" version of it. The effect you're seeing here is the root path (/) being translated to an empty path. There are in fact tests for this behaviour, so it is intentional.
However, maybe cURL needs correcting for this. Keep in mind that fragments are a client-side behaviour, and shouldn't be getting passed through at all (which I suspect is the real bug here).
Action plan:
- Create a test case to proof or disproof that there is a bug.
- If a failing test can be created: fix the bug.
- Otherwise close this ticket.
Additionally @schlessera will check the URL specs to verify whether passing #fragment should be handled or not.