cURL / Mailing Lists / curl-library / Single Mail

curl-library

RE: Post using https -- how can I avoid "Content-Length: 0"?

From: Jeff and Lita Pratt <jcpratt_at_spiritone.com>
Date: Tue, 13 Mar 2012 17:10:12 -0700

Thanks for the prompt reply, Daniel!

> -----Original Message-----
> From: curl-library-bounces_at_cool.haxx.se [mailto:curl-library-
> bounces_at_cool.haxx.se] On Behalf Of Daniel Stenberg
> Sent: Tuesday, March 13, 2012 3:09 PM
> To: libcurl development
> Subject: Re: Post using https -- how can I avoid "Content-Length: 0"?
>
> On Tue, 13 Mar 2012, Jeff Pratt wrote:
>
> > I'm rather new to libcurl.  I need to communicate with a server that
> > wants https, but they don't really do authentication (or so they
> > say).
> > It appears that I'm connecting to the site successfully but sending
> only a header:
>
> It looks like you intend to send a multipart formpost to the server? If
> so, then I think you should instead use curl_formadd() to add sections
> to the formpost and let libcurl create the linked list of 'struct
> curl_httppost'.

Well I'd love to try that but as far as I can tell there's no "form"
involved.
The documentation says:

     ...it uses HTTP without any SOAP (Simple Object Access Protocol)
wrappers.
     Requests are sent to the service by sending a specially constructed XML
documents using HTTP
     POST. Responses are returned from the server in a similar way by
sending an XML document
     containing the results.

>
> Take a look at this example which does this:
> http://curl.haxx.se/libcurl/c/postit2.html
>
> > The content I'm trying to send is xml in a flat file... so I'm using
> >         curl_easy_setopt(curl, CURLOPT_READDATA, pf);
>

This is interesting but I don't have any field names to use, as far as I can
tell.
 
> ... or do you want to pass on the data using some other means? Perhaps
> just sending the raw file in the body of the post request?

Now that's a thought. I can easily read my files into a buffer -- I send
then one-at-a-time and they're all in the range of 2500 to 4000 bytes max.
How would I go about doing this?

> If you help us specify exactly how you want the data sent I think we
> can recommend the correct fix.

Many thanks for the assistance (and apologies if I'm not formatting this
correctly!)

Regards,

Jeff Pratt

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2012-03-14