cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: [Patch] Avoid sending the URL fragment

From: Claes Jakobsson <claes_at_versed.se>
Date: Sun, 3 Jan 2010 20:01:28 +0100

On 3 jan 2010, at 12.33, Julien Chaffraix wrote:
>> However, I'm in doubt about the part that mangles path#fragment?query to path?query. As specified by the URI RFC the fragment is always the last part and anything after it can be disregarded. This would also make the patch a lot simpler.
>
> You are right. I misunderstood the fragment's position. I have
> attached the updated patch (which also add a mention about this change
> in the curl_easy_setopt manpage) and test case to match the URI RFC.
>
> Thanks for the review!

<snip>
+ /* Remove the fragment part of the path. Per RFC 2396, this is always the
+ last part of the URI. */
+ fragment = strrchr(path, '#');
+ if(fragment)
+ *fragment = 0;
</snip>

Altho the specification forbids any # in the fragment part I think it's better to look for the leftmost # and consider everything after that the fragment. That way "http://foo/#bar#baz" won't cause any problems.

/Claes

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2010-01-03