> This is an extract of the code I am using
>
> ========================================================================
> ===
> CURLcode last_error = curl_global_init(needSSL ? CURL_GLOBAL_SSL :
> CURL_GLOBAL_NOTHING);
> curlHandle = curl_easy_init();
>
> curl_easy_setopt(curlHandle, CURLOPT_URL, "https://some-address";);
> curl_easy_setopt(curlHandle, CURLOPT_HTTPPOST, 1);
> curl_easy_setopt(curlHandle, CURLOPT_VERBOSE, 1);
>
> std::string formdata = "service_check=asd/fg/+/hjg23+Qkl";
> curl_easy_setopt(curlHandle, CURLOPT_POSTFIELDS, formdata.c_str());
> curl_easy_setopt(curlHandle, CURLOPT_POSTFIELDSIZE, formdata.size());
>
> curl_easy_setopt(curlHandle, CURLOPT_HEADERFUNCTION, writeHeader);
> curl_easy_setopt(curlHandle, CURLOPT_HEADERDATA, this);
> curl_easy_setopt(curlHandle, CURLOPT_WRITEFUNCTION, writeData);
> curl_easy_setopt(curlHandle, CURLOPT_WRITEDATA, this);
>
> int status = curl_easy_perform(curlHandle);
> ========================================================================
> ===

You don't specify the content-type for the data you're posting. Curl
defaults to
"application/x-www-form-urlencoded". But your data is *NOT* URL encoded. So
you have a disconnect between what you're telling CURL you're giving it and
what you're actually giving it.

A "+" URL encodes to "%2B" and decodes to " ". So most likely the logic on
the other end sees that the data is URL encoded (since that's what CURL
tells it, by default) and decodes it, turning the '+' into a space.

The fix is to use a proper library to assembly the form data, one that
provides a function that takes a parameter and a value and properly encodes
it into WWW form data.

DS


______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    openssl-users@openssl.org
Automated List Manager                           majord...@openssl.org

Reply via email to