diff options
-rw-r--r-- | lib/Utils/abrt_curl.cpp | 8 | ||||
-rw-r--r-- | lib/Utils/abrt_curl.h | 1 |
2 files changed, 7 insertions, 2 deletions
diff --git a/lib/Utils/abrt_curl.cpp b/lib/Utils/abrt_curl.cpp index 23ce8e4a..49d6e0b3 100644 --- a/lib/Utils/abrt_curl.cpp +++ b/lib/Utils/abrt_curl.cpp @@ -210,9 +210,13 @@ abrt_post(abrt_post_state_t *state, error_msg_and_die("out of memory or read error"); xcurl_easy_setopt_ptr(handle, CURLOPT_HTTPPOST, post); } else { - // .. from a blob in memory. If data_size == -1, curl will use strlen(data) + // .. from a blob in memory xcurl_easy_setopt_ptr(handle, CURLOPT_POSTFIELDS, data); - xcurl_easy_setopt_long(handle, CURLOPT_POSTFIELDSIZE_LARGE, data_size); + // note1: if data_size == ABRT_POST_DATA_STRING == -1, curl will use strlen(data) + xcurl_easy_setopt_long(handle, CURLOPT_POSTFIELDSIZE, data_size); + // note2: CURLOPT_POSTFIELDSIZE_LARGE can't be used: xcurl_easy_setopt_long() + // truncates data_size on 32-bit arch. Need xcurl_easy_setopt_long_long()? + // Also, I'm not sure CURLOPT_POSTFIELDSIZE_LARGE special-cases -1. } // Override "Content-Type:" struct curl_slist *httpheader_list = NULL; diff --git a/lib/Utils/abrt_curl.h b/lib/Utils/abrt_curl.h index 97642bd4..b1ecd249 100644 --- a/lib/Utils/abrt_curl.h +++ b/lib/Utils/abrt_curl.h @@ -48,6 +48,7 @@ enum { ABRT_POST_WANT_BODY = (1 << 2), }; enum { + /* Must be -1! CURLOPT_POSTFIELDSIZE interprets -1 as "use strlen" */ ABRT_POST_DATA_STRING = -1, ABRT_POST_DATA_FROMFILE = -2, ABRT_POST_DATA_FROMFILE_AS_FORM_DATA = -3, |