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-1766458 ] --form type= parameter isn't sent

From: SourceForge.net <noreply_at_sourceforge.net>
Date: Fri, 03 Aug 2007 14:13:11 -0700

Bugs item #1766458, was opened at 2007-08-02 23:39
Message generated for change (Settings changed) made by bagder
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=100976&aid=1766458&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: wrong behaviour
>Status: Closed
Resolution: Invalid
Priority: 5
Private: No
Submitted By: Matt Pulver (pulver)
Assigned to: Daniel Stenberg (bagder)
Summary: --form type= parameter isn't sent

Initial Comment:
Using version 7.16.4 of curl:

/var/tmp/curl-7.16.4/src/curl -F "order=@input.xml;type=application/xml" http://localhost/

produces the following in the logs on the localhost server:

SERVER_NAME: localhost
PATH_INFO: /
CONTENT_LENGTH: "1967"
HTTP_CONTENT_TYPE: multipart/form-data; boundary=----------------------------9ab4290e7a8a
HTTP_USER_AGENT: curl/7.16.4 (i686-pc-linux-gnu) libcurl/7.16.4 OpenSSL/0.9.7e zlib/1.2.2 libidn/0.5.8
SCRIPT_NAME: /
SERVER_PROTOCOL: HTTP/1.1
HTTP_HOST: localhost
REMOTE_ADDR: 10.0.0.10
SERVER_SOFTWARE: Mongrel 1.0.1
HTTP_CONTENT_LENGTH: "1967"
REQUEST_PATH: /
CONTENT_TYPE: multipart/form-data; boundary=----------------------------9ab4290e7a8a
HTTP_VERSION: HTTP/1.1
REQUEST_URI: /
SERVER_PORT: "80"
GATEWAY_INTERFACE: CGI/1.2
HTTP_EXPECT: 100-continue
HTTP_ACCEPT: "*/*"
REQUEST_METHOD: POST

Note the content-type begins with multipart/form-data. This should be application/xml as given by the type parameter to --form.

Version info:

$ /var/tmp/curl-7.16.4/src/curl -V
curl 7.16.4 (i686-pc-linux-gnu) libcurl/7.16.4 OpenSSL/0.9.7e zlib/1.2.2 libidn/0.5.8
Protocols: tftp ftp telnet dict ldap http file https ftps
Features: IDN Largefile NTLM SSL libz

Matt

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

Comment By: Daniel Stenberg (bagder)
Date: 2007-08-02 23:43

Message:
Logged In: YES
user_id=1110
Originator: NO

No, then you've misunderstood what type that sets.

The "type=" passed to --form sets the content-type for that specific
formpart in the post. If you want to change the Content-Type for the whole
post (which is the content-type you showed here) you need to use -H
"Content-Type: yadayada"

BUT, it is very unlikely that you want to change the primary Content-Type
if you do multipart formposts, and also if you do you'll make a broken post
since you can't possibly know what boundary string curl will use and that
needs to be included in that Content-Type: header for the formpost to
work.

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

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

These mail archives are generated by hypermail.

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

File upload with ASP.NET