cURL / Mailing Lists / curl-library / Single Mail


Re: URL Fragment following redirect

From: Daniel Stenberg <>
Date: Tue, 14 Apr 2009 12:52:56 +0200 (CEST)

On Mon, 13 Apr 2009, Peter McLachlan wrote:

> 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:
>, 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

I think I would argue that libcurl should cut off the fragment
unconditionally. It's not (by spec) a part of the path part that should be
sent in the HTTP request so I think it's more correct to strip it off.

You up to writing a patch that makes it do this?

Received on 2009-04-14