cURL
Haxx ad
libcurl

curl's project page on SourceForge.net

Sponsors:
Haxx

cURL > Mailing List > Monthly Index > Single Mail

curl-tracker Archives

[ curl-Bugs-3375603 ] curl has problem with remote names containing '; '

From: SourceForge.net <noreply_at_sourceforge.net>
Date: Mon, 25 Jul 2011 02:02:35 +0200

Bugs item #3375603, was opened at 2011-07-22 16:39
Message generated for change (Comment added) made by xake
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=100976&aid=3375603&group_id=976

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: client module
Group: bad behaviour
Status: Open
Resolution: Accepted
Priority: 5
Private: No
Submitted By: Peter Hjalmarsson (xake)
Assigned to: Daniel Stenberg (bagder)
Summary: curl has problem with remote names containing ';'

Initial Comment:
at least curl-7.21.4 up to git commit dcc8481a13adc64661cd942d9c4009743ffdd620 has problems with "curl -J -O $url" if the remote-name for $url contains ';'.
It cuts the name right there after, so if the name is "foo;bar.txt" curl will name the file "foo".
As example we have 'curl -J -O "http://www.nyaa.eu/?page=download&tid=229569"' (sorry about the choice of link, this was the first public link I could find exposing the problem) which will create a file called "[HorribleSubs] Steins" instead of "<foo>Steins;Gate<bar>.torrent".

As a workaround I hacked the following patch which takes filename=, checks if its value begins with ", and if it does, do not terminate by a ';' but the next coming ".

This patch passes the testcases, but is really dirty, and more of a proof of what may work. Modify it, or choose a different approach, the choice is yours.

Have tested this on Gentoo and Fedora15.

----------------------------------------------------------------------

>Comment By: Peter Hjalmarsson (xake)
Date: 2011-07-25 02:02

Message:
Heh, a little polish?;)
However I took a look at RFC 1806 which seems to define
Content-Disposition, and it seems to imply no really restrictions what so
ever on the format of what comes after filename=, and it seems like the
only restrictions in the end are the ones for the local system/filesystem.
And since at least " is a valid character in filenames in linux it imposes
possible problems to rely upon that character in any way.

So I made a test and replaced ';' in the original code with '\n', and it
passes the testcase and works with the above give link on Fedora15/Gentoo
here. I however have no possibility to confirm if it poses any problems on
any ther platform...

----------------------------------------------------------------------

Comment By: Daniel Stenberg (bagder)
Date: 2011-07-22 20:02

Message:
Yes this is clearly a bug. I think the patch needs a little more polish
though...

----------------------------------------------------------------------

You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=100976&aid=3375603&group_id=976
Received on 2011-07-25

These mail archives are generated by hypermail.

donate! Page updated November 12, 2010.
web site info

File upload with ASP.NET