summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDenys Vlasenko <dvlasenk@redhat.com>2011-02-04 15:35:48 +0100
committerDenys Vlasenko <dvlasenk@redhat.com>2011-02-04 15:35:48 +0100
commit0f8c8f7a672351c72ce70286d8f43100f2ddcd2f (patch)
treee6ff4361336109122ac9223b09fd6cee11423838
parent4053436e9987871b089843f4ef447eb9e899be0b (diff)
downloadabrt-0f8c8f7a672351c72ce70286d8f43100f2ddcd2f.tar.gz
abrt-0f8c8f7a672351c72ce70286d8f43100f2ddcd2f.tar.xz
abrt-0f8c8f7a672351c72ce70286d8f43100f2ddcd2f.zip
abrt_curl: add "Accept: text/plain" header to our HTTP transactions
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
-rw-r--r--src/lib/abrt_curl.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/lib/abrt_curl.c b/src/lib/abrt_curl.c
index 74aae062..a17f14d2 100644
--- a/src/lib/abrt_curl.c
+++ b/src/lib/abrt_curl.c
@@ -287,8 +287,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);
@@ -300,6 +302,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,