cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: post binary data using curlopt_postfields option

From: Vemana Yogi <yogi.elgoog_at_gmail.com>
Date: Wed, 9 Jun 2010 14:08:46 -0700

I am not using any specific authentication that will mask any headers. Here
is what I'm doing and trying to figure out what's going on under the hood to
fix my issue:

I am using libcurl via CURLM to send requests to the services running
yapache on freebsd. I am posting data, and expecting a returned response
from the service. I'm using a json request format (encoding the request in
binary format), where in mutliple requests are embedded inside one request,
and this is put inside the body. Service A reads this one request, decodes
it, and parses the addition requests by reading the body and does the needed
processing.

I am sticking to this set of apis to get this working as this works when I
send 6 requests, but the below fails from seventh request onwards. I get an
error that an additional 00 was detected in the request format and hence the
service was not able to decode things right.

curl_easy_setopt(handle, CURLOPT_POSTFIELDS, bs->c_str());
curl_easy_setopt(handle, CURLOPT_POSTFIELDSIZE, bs->size());

I verified encoding and decoding the request data before even sending the
request to the service, and there was no additional 00, so this tells me
something is getting added on the wire when it hits the service. I am using
tcpdump analyze it. In addition, when I do the same thing via php, sending
multiple requests, everything works.

Any ideas on what could be going on?

Thank you

Yogi

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2010-06-09