cURL
Haxx ad
libcurl

curl's project page on SourceForge.net

Sponsors:
Haxx

cURL > Mailing List > Monthly Index > Single Mail

curl-tracker mailing list Archives

[ curl-Bugs-3048988 ] -F option loses charset from the type={content-type}

From: SourceForge.net <noreply_at_sourceforge.net>
Date: Fri, 20 Aug 2010 22:26:48 +0000

Bugs item #3048988, was opened at 2010-08-20 00:17
Message generated for change (Comment added) made by bagder
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=100976&aid=3048988&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: http
>Group: bad behaviour
>Status: Closed
>Resolution: Fixed
Priority: 5
Private: No
Submitted By: Larry Stone (lcs8)
Assigned to: Daniel Stenberg (bagder)
Summary: -F option loses charset from the type={content-type}

Initial Comment:
In a command like this:

echo "stuff" | curl -s -F action=update -F 'insert=@-;type=text/rdf+n3;charset="ISO-8859-1"' -F foo=bar (...) http://localhost/do/stuff

The POST content is built with a section for the insert arg like so:
...
0065: ------------------------------1a1eb5fda8f7
0091: Content-Disposition: form-data; name="insert"; filename="-"
00ce: Content-Type: text/rdf+n3
00e9:
...

The entity's Content-Type: header is missing the "charset" parameter supplied to the -F argument. It is given the correct MIME type string, just bereft of its parameters. According to the HTTP 1.1 spec, RFC 2616 section 14.17, the media-type value is allowed to contain embedded whitespace as well as a semicolon followed by the character set description, e.g.
Content-Type: text/html; charset=ISO-8859-4

Curl should detect a charset parameter if it is present in the "type=" value, and include it in the entity's content-type header in the generated POST multipart document.

This behavior was tested on the current latest curl (7.21.1) as well as 7.19.7 on MacOS X 10.6. -V output is:
curl 7.21.1 (i386-apple-darwin10.4.0) libcurl/7.21.1 OpenSSL/0.9.8l zlib/1.2.3 c-ares/1.7.3 libssh2/1.2.6
Protocols: dict file ftp ftps http https imap imaps ldap pop3 pop3s rtsp scp sftp smtp smtps telnet tftp
Features: AsynchDNS GSS-Negotiate IPv6 Largefile NTLM SSL libz

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

Comment By: Daniel Stenberg (bagder)
Date: 2010-08-21 00:26

Message:
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/

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

You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=100976&aid=3048988&group_id=976
Received on 2010-08-21

These mail archives are generated by hypermail.

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

File upload with ASP.NET