cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: [ curl-Bugs-631028 ] Fails saveing using -O if URL has spaces

From: Philippe Lhoste <PhiLho_at_GMX.net>
Date: Wed, 6 Nov 2002 09:21:49 +0000 (UTC)

On 2002/10/30 14:17:04, Nobody/Anonymous on sourceforge.net wrote:

> Initial Comment:
> Bug seems to stip spaces out of URLs when using the -
> O option:-
>
> In this version:-
>
> curl 7.10 (win32) libcurl/7.10 OpenSSL/0.9.6g
>
> This command works and prints the file on the screen:-
>
> curl -x
> proxy.ozzienet.net:8080 "http://somehost.com/url with
> spaces in it/file.mpg"
>
> This command fails:-
>
> curl -O -x
> proxy.ozzienet.net:8080 "http://somehost.com/url with
> spaces in it/file.mpg"
>
> Because it writes something like this into the file.mpg:-
>
> <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML
> 2.0//EN">
> <HTML><HEAD>
> <TITLE>404 Not Found</TITLE>
> </HEAD><BODY>
> <H1>Not Found</H1>
> The requested URL /urlwithspacesinit/file.mpg was not
> found on this server.<P>
> <HR>
> <ADDRESS>Apache/1.3.23 Server at somehost.com
> Port 80</ADDRESS>
> </BODY></HTML>

At first, it seems to be normal behavior, since spaces aren't valid URL
characters.

I made a quick try, using the IIS on my computer:

> curl -O http://1.0.0.111/index.html
OK

> curl -O http://1.0.0.111/Copy of tagada.shtml
curl: (6) Couldn't resolve host 'of'
curl: (6) Couldn't resolve host 'tagada.shtml'

> curl -O "http://1.0.0.111/Copy of tagada.shtml"
<h2>HTTP Error 400</h2>
<p><strong>400 Bad Request</strong></p>
<p>Due to malformed syntax, the request could not be understood by the
server. The client should not repeat the request without
modifications.</p>

> curl -O http://1.0.0.111/Copy%20of%20tagada.shtml
Got it, but wrote "Copy%20of%20tagada.shtml"...
That's not very nice, perhaps here Curl should transform all URL entities
(%xx) to corresponding characters. As long as they are not illegal for the
current OS, which can be tricky to do in a portable way.
Or just use a script to post-process the file name...

-- 
--=#=--=#=--=#=--=#=--=#=--=#=--=#=--=#=--=#=--
Philippe Lhoste (Paris -- France)
Professional programmer and amateur artist
http://jove.prohosting.com/~philho/
-------------------------------------------------------
This sf.net email is sponsored by: See the NEW Palm 
Tungsten T handheld. Power & Color in a compact size!
http://ads.sourceforge.net/cgi-bin/redirect.pl?palm0001en
Received on 2002-11-06