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.
This commit is contained in:
Sebastian Dröge 2014-09-04 12:14:11 +03:00
parent 558f9a2a6f
commit 4b697df494

View file

@ -1203,7 +1203,8 @@ gst_soup_http_src_got_headers_cb (SoupMessage * msg, GstSoupHTTPSrc * src)
src->seekable = FALSE; src->seekable = FALSE;
GST_ELEMENT_ERROR (src, RESOURCE, SEEK, GST_ELEMENT_ERROR (src, RESOURCE, SEEK,
(_("Server does not support seeking.")), (_("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; 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) \ #define SOUP_HTTP_SRC_ERROR(src,soup_msg,cat,code,error_message) \
GST_ELEMENT_ERROR ((src), cat, code, ("%s", error_message), \ GST_ELEMENT_ERROR ((src), cat, code, ("%s", error_message), \
("%s (%d), URL: %s", (soup_msg)->reason_phrase, \ ("%s (%d), URL: %s, Redirect to: %s", (soup_msg)->reason_phrase, \
(soup_msg)->status_code, (src)->location)); (soup_msg)->status_code, (src)->location, GST_STR_NULL ((src)->redirection_uri)));
static void static void
gst_soup_http_src_parse_status (SoupMessage * msg, GstSoupHTTPSrc * src) 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) { if (msg->status_code == SOUP_STATUS_NOT_FOUND) {
GST_ELEMENT_ERROR (src, RESOURCE, NOT_FOUND, GST_ELEMENT_ERROR (src, RESOURCE, NOT_FOUND,
("%s", msg->reason_phrase), ("%s", msg->reason_phrase),
("%s (%d), URL: %s", msg->reason_phrase, msg->status_code, ("%s (%d), URL: %s, Redirect to: %s", msg->reason_phrase,
src->location)); msg->status_code, src->location,
} else if (msg->status_code == SOUP_STATUS_UNAUTHORIZED || GST_STR_NULL (src->redirection_uri)));
msg->status_code == SOUP_STATUS_PAYMENT_REQUIRED || } else if (msg->status_code == SOUP_STATUS_UNAUTHORIZED
msg->status_code == SOUP_STATUS_FORBIDDEN || || msg->status_code == SOUP_STATUS_PAYMENT_REQUIRED
msg->status_code == SOUP_STATUS_PROXY_AUTHENTICATION_REQUIRED) { || msg->status_code == SOUP_STATUS_FORBIDDEN
GST_ELEMENT_ERROR (src, RESOURCE, NOT_AUTHORIZED, || msg->status_code == SOUP_STATUS_PROXY_AUTHENTICATION_REQUIRED) {
("%s", msg->reason_phrase), GST_ELEMENT_ERROR (src, RESOURCE, NOT_AUTHORIZED, ("%s",
("%s (%d), URL: %s", msg->reason_phrase, msg->status_code, msg->reason_phrase), ("%s (%d), URL: %s, Redirect to: %s",
src->location)); msg->reason_phrase, msg->status_code, src->location,
GST_STR_NULL (src->redirection_uri)));
} else { } else {
GST_ELEMENT_ERROR (src, RESOURCE, OPEN_READ, GST_ELEMENT_ERROR (src, RESOURCE, OPEN_READ,
("%s", msg->reason_phrase), ("%s", msg->reason_phrase),
("%s (%d), URL: %s", msg->reason_phrase, msg->status_code, ("%s (%d), URL: %s, Redirect to: %s", msg->reason_phrase,
src->location)); msg->status_code, src->location,
GST_STR_NULL (src->redirection_uri)));
} }
src->ret = GST_FLOW_ERROR; src->ret = GST_FLOW_ERROR;
} }