From 4b697df4949b87eac373b7eeef0c0a9b5b1a5f7f Mon Sep 17 00:00:00 2001 From: =?utf8?q?Sebastian=20Dr=C3=B6ge?= Date: Thu, 4 Sep 2014 12:14:11 +0300 Subject: [PATCH] souphttpsrc: Include redirection target in error messages Just giving the original URI can give the false impression that e.g. that one failed host name resolution, while actually the redirection target did. --- ext/soup/gstsouphttpsrc.c | 33 ++++++++++++++++++--------------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/ext/soup/gstsouphttpsrc.c b/ext/soup/gstsouphttpsrc.c index 11842f1..35fa2de 100644 --- a/ext/soup/gstsouphttpsrc.c +++ b/ext/soup/gstsouphttpsrc.c @@ -1203,7 +1203,8 @@ gst_soup_http_src_got_headers_cb (SoupMessage * msg, GstSoupHTTPSrc * src) src->seekable = FALSE; GST_ELEMENT_ERROR (src, RESOURCE, SEEK, (_("Server does not support seeking.")), - ("Server does not accept Range HTTP header, URL: %s", src->location)); + ("Server does not accept Range HTTP header, URL: %s, Redirect to: %s", + src->location, GST_STR_NULL (src->redirection_uri))); src->ret = GST_FLOW_ERROR; } @@ -1461,8 +1462,8 @@ gst_soup_http_src_response_cb (SoupSession * session, SoupMessage * msg, #define SOUP_HTTP_SRC_ERROR(src,soup_msg,cat,code,error_message) \ GST_ELEMENT_ERROR ((src), cat, code, ("%s", error_message), \ - ("%s (%d), URL: %s", (soup_msg)->reason_phrase, \ - (soup_msg)->status_code, (src)->location)); + ("%s (%d), URL: %s, Redirect to: %s", (soup_msg)->reason_phrase, \ + (soup_msg)->status_code, (src)->location, GST_STR_NULL ((src)->redirection_uri))); static void gst_soup_http_src_parse_status (SoupMessage * msg, GstSoupHTTPSrc * src) @@ -1533,21 +1534,23 @@ gst_soup_http_src_parse_status (SoupMessage * msg, GstSoupHTTPSrc * src) if (msg->status_code == SOUP_STATUS_NOT_FOUND) { GST_ELEMENT_ERROR (src, RESOURCE, NOT_FOUND, ("%s", msg->reason_phrase), - ("%s (%d), URL: %s", msg->reason_phrase, msg->status_code, - src->location)); - } else if (msg->status_code == SOUP_STATUS_UNAUTHORIZED || - msg->status_code == SOUP_STATUS_PAYMENT_REQUIRED || - msg->status_code == SOUP_STATUS_FORBIDDEN || - msg->status_code == SOUP_STATUS_PROXY_AUTHENTICATION_REQUIRED) { - GST_ELEMENT_ERROR (src, RESOURCE, NOT_AUTHORIZED, - ("%s", msg->reason_phrase), - ("%s (%d), URL: %s", msg->reason_phrase, msg->status_code, - src->location)); + ("%s (%d), URL: %s, Redirect to: %s", msg->reason_phrase, + msg->status_code, src->location, + GST_STR_NULL (src->redirection_uri))); + } else if (msg->status_code == SOUP_STATUS_UNAUTHORIZED + || msg->status_code == SOUP_STATUS_PAYMENT_REQUIRED + || msg->status_code == SOUP_STATUS_FORBIDDEN + || msg->status_code == SOUP_STATUS_PROXY_AUTHENTICATION_REQUIRED) { + GST_ELEMENT_ERROR (src, RESOURCE, NOT_AUTHORIZED, ("%s", + msg->reason_phrase), ("%s (%d), URL: %s, Redirect to: %s", + msg->reason_phrase, msg->status_code, src->location, + GST_STR_NULL (src->redirection_uri))); } else { GST_ELEMENT_ERROR (src, RESOURCE, OPEN_READ, ("%s", msg->reason_phrase), - ("%s (%d), URL: %s", msg->reason_phrase, msg->status_code, - src->location)); + ("%s (%d), URL: %s, Redirect to: %s", msg->reason_phrase, + msg->status_code, src->location, + GST_STR_NULL (src->redirection_uri))); } src->ret = GST_FLOW_ERROR; } -- 2.7.4