curl-library
Multipart Problems on Windows
Date: Mon, 8 Nov 2010 13:21:45 +0100
Hello Everybody
I have problems sending multipart curl requests on Windows. On Unix, it works properly. But on Windows, I am not able to make it work. To show you the problem, I attached an example to the email. It is a little cmake project. To compile and run it, you need to do the following:
On Unix:
- install curl, cmake and g++ compiler
- mv CMakeLists.txt and main.cpp into <dir>
- create build directory
- cd <build_dir>
- execute cmake <path_to_dir>
- execute make
- execute curl_example
On Windows:
- install cmake and Visual Studio
- compile curl or get curl binaries from curl homepage
- mv CMakeLists.txt and main.cpp into <dir>
- create build directory
- in Visual Studio cmd
- cd <build_dir>
- execute cmake -G "NMake Makefiles" -D CURL_INCLUDE_DIR=<path_to_curl_include_dir> -D CURL_LIBRARY=<path_to_libcurl.lib> <path_to_dir>
- execute nmake
- execute curl_example.exe
When I executed the two possibilities, I used charles to see the request sent to the server:
Request on Windows:
POST /rest-tests/request.php HTTP/1.1
User-Agent: libcurl-agent/1.0
Host: www.zorba-xquery.com
Pragma: no-cache
Accept: */*
foo: bar
Content-Type: multipart/mixed
Content-Length: 209
Expect: 100-continue
Content-Type: multipart/form-data; boundary=----------------------------8ca4b30ac652
------------------------------8ca4b30ac652
Content-Disposition: form-data; name="blubb"
Content-Type: text/plain
insidem
Request on Linux:
POST /rest-tests/request.php HTTP/1.1
User-Agent: libcurl-agent/1.0
Host: www.zorba-xquery.com
Accept: */*
foo: bar
Content-Length: 463
Expect: 100-continue
Content-Type: multipart/mixed; boundary=----------------------------e2eb3d5b18f1
------------------------------e2eb3d5b18f1
Content-Disposition: form-data; name="blubb"
Content-Type: text/plain
insidemultipart:blubb
A small text test
------------------------------e2eb3d5b18f1
Content-Disposition: form-data; name="blubb"
Content-Type: text/plain
Another small text body
------------------------------e2eb3d5b18f1
Content-Disposition: form-data; name="blubb"
img/png
lqenw
------------------------------e2eb3d5b18f1--
They are very different. On Windows, almost everything is missing. Can someone help me on this issue?
Thanks
David
------------
David Graf
Software Architect
28msec Inc.
http://www.28msec.com/
http://twitter.com/28msec
------------
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2010-11-08