cURL / Mailing Lists / curl-library / Single Mail

curl-library

URL Fragment following redirect

From: Peter McLachlan <peter_at_mobify.me>
Date: Mon, 13 Apr 2009 14:14:28 -0700

Hi there,

I'm not sure this is a bug per se, but it is a case where curl behaves
differently than web browsers. If FOLLOWLOCATION is true, and the
target location has a fragment in it (often also called an HTML anchor
such as: http://foo.bar.com/index.html#whatever), the anchor part of
the target gets passed through to the web server as part of the
request. I've observed this behavior with the latest release build of
curl, 7.19.4. This is not the default behavior for web browsers which
truncate the fragment portion of the URL for making their request to
the web server. (As confirmed by sniffing on the wire during the
requests -- interestingly, firefox will show sending the full URL
including the fragment if the headers are examined inside the browser
using firebug or another tool, but the wire never lies...)

I'm hoping a future release of curl can include an option to truncate
fragments. TRUNCATEFRAGMENTONREDIRECT perhaps?

Thanks for all the great work everyone on the dev team!

Peter McLachlan

http://mobify.me
Received on 2009-04-13