The base_api_url is not free()d anywhere (I understand that using free
in main() is not strictly necessary, but I believe we should be
consistent -- either free everything or nothing).
Other than that, the patch looks good:)
On Tue, Mar 26, 2013 at 11:32:59 +0100, Denys Vlasenko wrote:
We should use rs/problems, not rs/cases/NNNNNNNN/problems.
To make similar bugs easier to spot in the future,
I added error message if we did get an error.
Signed-off-by: Denys Vlasenko <dvlasenk(a)redhat.com>
---
src/plugins/reporter-rhtsupport.c | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
diff --git a/src/plugins/reporter-rhtsupport.c b/src/plugins/reporter-rhtsupport.c
index 1183225..4a0d898 100644
--- a/src/plugins/reporter-rhtsupport.c
+++ b/src/plugins/reporter-rhtsupport.c
@@ -260,6 +260,8 @@ int main(int argc, char **argv)
);
free_map_string(settings);
+ char *base_api_url = xstrdup(url);
+
if (opts & OPT_t)
{
if (!case_no)
@@ -385,7 +387,7 @@ int main(int argc, char **argv)
{
/* Check for hints and show them if we have something */
log(_("Checking for hints"));
- result = get_rhts_hints(url,
+ result = get_rhts_hints(base_api_url,
login,
password,
ssl_verify,
@@ -408,6 +410,16 @@ int main(int argc, char **argv)
"</problems>"
);
#endif
+ if (result->error)
+ {
+ /* We don't use result->msg here because it looks like this:
+ * Error in file upload at 'URL', HTTP code: 404,
+ * server says:
'<?xml...?><error...><code>404</code><message>...</message></error>'
+ * TODO: make server send bare textual msgs, not XML.
+ */
+ error_msg("Error in file upload at '%s', HTTP code: %d",
+ base_api_url, result->http_resp_code);
+ }
if (result->error == 0 && result->body)
{
/* The message might contain URLs to known solutions and such */
--
1.8.1.4