cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Uploading with POST and read_callback not just a file

From: Julien Chaffraix <julien.chaffraix_at_gmail.com>
Date: Mon, 19 Sep 2011 20:22:04 -0700

Just to add on what Daniel answered:

> body.append("--d31fcjR2\r\n");

This is a delimiter of a multi-part POST. You are not supposed to add
them yourself: just let libcURL handle this (you don't need to know
where / how cURL will split your data). See
http://curl.haxx.se/libcurl/c/curl_easy_setopt.html#CURLOPTHTTPPOST.

> body.append("Content-Type: application/atom+xml; charset=UTF-8\r\n");

This is a header, use CURLOPT_HTTPHEADER to properly add it. Just add
all the relevant headers for the first request from the doc and
libcURL should automatically handle the ones that need to be repeated
as part of the multi-part POST. Your code should just care about
sending the content not the low-level details of how it is transfered.

Hope it helps,
Julien
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2011-09-20