On Tuesday 29 of May 2012 11:46:05 Nikola Pajkovsky wrote:
> Richard Marko <rmarko@redhat.com> writes:
> > 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);
>
> NACK, multiple instances of reporter-ureport will override
> /tmp/ureport.json. use mkstemp.
Please, see email with subject:
"[PATCH] track#542 : reporter-ureport uploads ureport files as html form does"
Sent by me at 2012-05-29 09:28:25