summaryrefslogtreecommitdiffstats
path: root/lib/Utils
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2010-06-15 11:23:53 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2010-06-15 11:23:53 +0200
commitf2b9b027b6ccb888829197c4b037077d5017d8eb (patch)
tree430f4bef66fccf3fd4c83ea5cfdc4dd04d2b184e /lib/Utils
parente804395f9791ab8d4c5d5ad6ebae06f7e8c4eb0a (diff)
downloadabrt-f2b9b027b6ccb888829197c4b037077d5017d8eb.tar.gz
abrt-f2b9b027b6ccb888829197c4b037077d5017d8eb.tar.xz
abrt-f2b9b027b6ccb888829197c4b037077d5017d8eb.zip
abrt_curl: fix a problem with incorrect content-length on 32-bit arches
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'lib/Utils')
-rw-r--r--lib/Utils/abrt_curl.cpp8
-rw-r--r--lib/Utils/abrt_curl.h1
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,