cURL / Mailing Lists / curl-users / Single Mail


RE: Whitespace in a Location: Hint

From: Daniel Stenberg <>
Date: Sun, 16 Jun 2002 15:18:08 +0200 (MET DST)

On Sun, 16 Jun 2002, James Cox wrote:

> Daniel: what Anthony described is that curl is taking a correctly
> urlencoded url and url-decoding it... so if there is a space url encoded,
> it'll decode the %20 into a space, however it does it before it reaches the
> document, therefore causing a problem.

Did he?

I saw a trace dump that included a Location: header with a URL to "go to":

  <= Recv header, 105 bytes (0x69)
  0000: Location: File
  0040: .doc?&STCO=1PQpV-M_at_i4CwAAGNMb2c&STCOEND

The right side of that header is what appears to me as an attempt to write a
URL with a space within it.

> whilst i agree that spaces suck, and should be mostly disregarded, it is
> still a valid issue.

The issue may be valid anyway, sure. But to make this work, we'd need to
change the Location: header parser to not stop parsing when it finds a space,
but to scan for a CRLF and possibly then only remove trailing spaces.

I'm not saying it couldn't work, I'm only saying that URLs are not meant to
contain spaces and thus curl doesn't quite work with them.

I'm for doing this change, as it problably improves how curl works in
real-world cases, who don't really care about that RFC1738 says about spaces
in URLs... :-)

    Daniel Stenberg -- curl groks URLs --
Sponsored by:
ThinkGeek at
Received on 2002-06-16