cURL / Mailing Lists / curl-users / Single Mail

curl-users

RE: Fwd: Bug#311112: curl: Escape <space> in HTTP requests

From: David Mooney <david.mooney_at_fujimed.com>
Date: Tue, 7 Jun 2005 08:52:24 -0400

> > I suppose it would make even more sense if it was made an option that
> converts
> > everything non-URL into its %HH-coded version and not only space. Like
>
> > --url-sanitise or something.
>
> If anyone attempts such a patch, make sure "?", "&", and "=" are NOT
> %HH-coded, as that would cause problems for someone using a URL with
> embedded form parameters. And also don't encode "/"...

On Windows there is an SDK function called InternetCanonicalizeUrl which
provides this feature. I understand you probably would want to implement
your own function but it might be worth looking at the docs to see the
various options this function provides.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wininet/wininet/internetcanonicalizeurl.asp

By default it encodes the entire url including characters after # or ? and
including meta sequences like "..". It has options to, 1) not encode
characters after # or ?, 2) also encode %, 3) encode only spaces, and 4)
not to encode meta sequences. For completeness and for curl to be a
competitive alternative to WinInet, I think all of these options should be
probably be available to the user.

Regards,
David Mooney
Received on 2005-06-07