cURL
Haxx ad
libcurl

curl's project page on SourceForge.net

Sponsors:
Haxx

cURL > Mailing List > Monthly Index > Single Mail

curlpp mailing list Archives

[cURLpp] Binary POST body gets mangled after first null

From: <curlpp_at_rrette.com_at_textnode.com>
Date: Fri, 18 Nov 2005 09:16:41 +0000

My first post, so hi folks!

I'm using the Easy interface to send an HTTP POST with a binary body to a server.

Snippet of code:
========================================
std::string Client::Post
(
    std::string const& url,
    StringList& headers,
    std::string const& data
)
{
    try
    {
        cURLpp::Easy request;
        request.setOpt( new cURLpp::Options::PostFields( const_cast<char*>( data.c_str() ) ) );
        request.setOpt( new cURLpp::Options::PostFieldSize( data.size() ) );
        request.setOpt( new cURLpp::Options::Url( url ) );
        OptimizeHeaderExpect( headers );
        request.setOpt( new cURLpp::Options::Header( true ) );
        request.setOpt( new cURLpp::Options::HttpHeader( headers ) );
        request.setOpt( new cURLpp::Options::NoProgress( true ) );
        request.perform();
        etc.....
=========================================

The start of the POST body data looks like this in hex:

8c 80 98 31 31 39 36 38 35 33 34 2d 66 64 31 62
2d 34 37 30 64 2d 38 63 32 65 2d 63 64 61 61 32
32 39 32 30 37 64 66 00 8d 90 89 19 80 2b 34 34
37 37 etc...

When the post is sent, an ethereal snoop shows that after the NULL the rest of the POST body is replaced by garbage (looks like the process heap).

I have verified that the data.c_str() is definitely correct by writing the content out to a file, char-by-char.

Has anyone come across this before? Have I misused the interface? Is it perhaps a known issue?

Many Thanks,
Darren

(P.S.

Software versions:
curl-7.15.0
curlpp-0.5.2

O.S.:
Redhat Linux AS 3.0
)

_______________________________________________
cURLpp mailing list
cURLpp_at_rrette.com
http://www.rrette.com/mailman/listinfo/curlpp
Received on 2005-11-18

These mail archives are generated by hypermail.

donate! Page updated November 12, 2010.
web site info

File upload with ASP.NET