Hi,

I am trying to send protocol buffer messages over HTTP using libcurl
in C++. I am POSTing in binary mode. It seems, upon posting data gets
corrupt.

Here is the code snippet:

-------------------------------
std::string st;
campaignpool.SerializeToString(&st);

//POST using curl

struct curl_slist *headers=NULL;
headers = curl_slist_append(headers, "Content-Type: application/octet-
stream");

 /* post binary data */
  easyhandle = curl_easy_init();
  curl_easy_setopt(easyhandle, CURLOPT_POSTFIELDS, &st);
  curl_easy_setopt(easyhandle, CURLOPT_POSTFIELDSIZE, st.size());
  curl_easy_setopt(easyhandle, CURLOPT_HTTPHEADER, headers);
  .........
  .........
  curl_easy_perform(easyhandle); /* post away! */

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

Any help would be highly appreciated.


Regards,
Zia
-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To post to this group, send email to proto...@googlegroups.com.
To unsubscribe from this group, send email to 
protobuf+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en.


Reply via email to