summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDenys Vlasenko <dvlasenk@redhat.com>2011-02-04 15:18:00 +0100
committerDenys Vlasenko <dvlasenk@redhat.com>2011-02-04 15:18:00 +0100
commitf46513d79dd6e1feb5c00dc5fae32d1a7fc10ab8 (patch)
tree9a60db78230a2bad6dde259a88c23c61bccfb7de
parent079ea1c88ff9e3022499b7382452b6c7b0ab61c8 (diff)
downloadabrt-f46513d79dd6e1feb5c00dc5fae32d1a7fc10ab8.tar.gz
abrt-f46513d79dd6e1feb5c00dc5fae32d1a7fc10ab8.tar.xz
abrt-f46513d79dd6e1feb5c00dc5fae32d1a7fc10ab8.zip
add "Accept: text/plain" header to our HTTP transactions
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
-rw-r--r--lib/Utils/abrt_curl.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/lib/Utils/abrt_curl.cpp b/lib/Utils/abrt_curl.cpp
index 3c58dc4a..2bb71092 100644
--- a/lib/Utils/abrt_curl.cpp
+++ b/lib/Utils/abrt_curl.cpp
@@ -297,8 +297,10 @@ abrt_post(abrt_post_state_t *state,
// 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;
+
+ // Override "Content-Type:"
if (data_size != ABRT_POST_DATA_FROMFILE_AS_FORM_DATA)
{
char *content_type_header = xasprintf("Content-Type: %s", content_type);
@@ -310,6 +312,12 @@ abrt_post(abrt_post_state_t *state,
xcurl_easy_setopt_ptr(handle, CURLOPT_HTTPHEADER, httpheader_list);
}
+ // Override "Accept: text/plain": helps convince server to send plain-text
+ // error messages in the body of HTTP error responses [not verified to work]
+ httpheader_list = curl_slist_append(httpheader_list, "Accept: text/plain");
+ if (!httpheader_list)
+ error_msg_and_die("out of memory");
+
// Disabled: was observed to also handle "305 Use proxy" redirect,
// apparently with POST->GET remapping - which server didn't like at all.
// Attempted to suppress remapping on 305 using CURLOPT_POSTREDIR of -1,
@@ -365,7 +373,7 @@ abrt_post(abrt_post_state_t *state,
}
// curl-7.20.1 doesn't do it, we get NULL body in the log message below
- // unless we fflush the body memestream ourself
+ // unless we fflush the body memstream ourself
if (body_stream)
fflush(body_stream);