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
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
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


Attachment: main.cpp
Description: Binary data

project (curl_example)
cmake_minimum_required (VERSION 2.6)

find_package (CURL REQUIRED)
include_directories (${CURL_INCLUDE_DIRS})

add_executable (curl_example main.cpp)
target_link_libraries (curl_example ${CURL_LIBRARIES})


------------
David Graf
Software Architect

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html

Reply via email to