curl-users
Re: Fwd: Bug#311112: curl: Escape <space> in HTTP requests
Date: Sat, 4 Jun 2005 10:28:24 +0200
Daniel Stenberg <daniel_at_haxx.se> wrote:
> On Sat, 28 May 2005, Domenico Andreoli wrote:
[...]
>> For example mp3 files often contain space characters in their
>> filename, however curl will not deal with that:
[...]
> Having curl translate illegal letters into something else would take
> a lot of effort and "intelligence" in the tool I much rather avoid.
> Is translation to %20 *always* wanted when you pass a space in the
> URL? I doubt that.
Hello,
I do not know the respective RFCs to answer this question correctly,
however I'd _guess_ that at least in a HTTP-URL 's/ /%20/g' is always
the correct thing to do. (That is whhat e.g. mozlla does.)
> Also (of course) different servers and different protocols will
> treat that literal space differently.
I was trying to comment only on HTTP(S). ;-)
>> Of course *I* could do the escaping and invoke curl
>> 'http://downhill.aus.cc/testingcurl/with%20space'
> That is what you are expected to do. If you want a %20 sent to a
> HTTP server.
Well, I do not want to "send %20", I want to fetch the file with the
_local_ name "with space" from my webserver. ;-)
>> however in that case I'll end up with a file named "with%20space"
>> locally if I use -O and will need to do manual de-escaping with
>> mmv, too.
> Yes, but if you don't like what -O gives you, why not use -o and
> intent your own file name?
That is what I do temporarily, but it is tiring. Compare
------8x-----
rawurl='http://downhill.aus.cc/testingcurl/with space'
escapedurl=`echo "$rawurl" | sed -e 's/ /%20/g'`
filename=`echo "$rawurl" | sed -e 's_.*/__'`
curl -o "$filename" "$escapedurl"
------8x-----
with
curl -O 'http://downhill.aus.cc/testingcurl/with space'
I'd expect curl to take off this grunt-work from me. I /thought/ curl
was supposed to not require intrisinic knowledge on HTTP (like e.g.
netcat). FWIW wget does what I suggested. - This is not intended as a
"If you don't do what I want you to, I'll switch to
$alternative_project" but eally ust as as a point of information from
a users POV, "${alternative, similar project} works this way, so it
might be safe".
Of course the behavior I sugest would need to be made default, I'd be
entirely happy with --escape-disallowed-characters-in-http-requests.
thanks for your work, cu andreas
-- "See, I told you they'd listen to Reason," [SPOILER] Svfurlr fnlf, fuhggvat qbja gur juveyvat tha. Neal Stephenson in "Snow Crash" http://downhill.aus.cc/Received on 2005-06-04