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.
quick and ugly patch
Yes this is clearly a bug. I think the patch needs a little more polish though...
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...
Replaces ';' with '\n', tested on linux.
Thanks for the report, this problem is now fixed in the git repository.
To try it out, you either checkout/update your git clone: http://curl.haxx.se/source.html
or you try tomorrow's daily snapshot: http://curl.haxx.se/snapshots/