This is how ureport has to be sent to the server.
Would be better to skip saving ureport to the file but I don't want to
touch lib/abrt_curl.c.
Report is also missing mandatory element 'reporter'.
---
src/lib/json.c | 10 +++++++---
1 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/src/lib/json.c b/src/lib/json.c
index 2adf4ee..dfdb641 100644
--- a/src/lib/json.c
+++ b/src/lib/json.c
@@ -237,15 +237,19 @@ abrt_post_state_t *post_ureport(problem_data_t *pd, const char
*ureport_url)
| ABRT_POST_WANT_ERROR_MSG);
static const char *headers[] = {
- "Accept: text/plain",
+ "Accept: application/json",
"Connection: close",
NULL,
};
char *json_ureport = new_json_ureport(pd);
- abrt_post_string(post_state, ureport_url, "application/json",
- headers, json_ureport);
+ FILE *tmpjson = fopen("/tmp/ureport.json", "w");
+ fputs(json_ureport, tmpjson);
+ fclose(tmpjson);
+
+ abrt_post_file_as_form(post_state, ureport_url, "application/json",
+ headers, "/tmp/ureport.json");
free(json_ureport);
--
1.7.7.6