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;
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;
}