Commit cf31a428 authored by Sebastian Dröge's avatar Sebastian Dröge 🍵

souphttpsrc: Add mapping for NOT_FOUND and NOT_AUTHORIZED errors

parent 5514bc27
......@@ -1184,11 +1184,26 @@ gst_soup_http_src_parse_status (SoupMessage * msg, GstSoupHTTPSrc * src)
/* FIXME: reason_phrase is not translated and not suitable for user
* error dialog according to libsoup documentation.
* FIXME: error code (OPEN_READ vs. READ) should depend on http status? */
GST_ELEMENT_ERROR (src, RESOURCE, OPEN_READ,
("%s", msg->reason_phrase),
("%s (%d), URL: %s", msg->reason_phrase, msg->status_code,
src->location));
*/
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));
} else {
GST_ELEMENT_ERROR (src, RESOURCE, OPEN_READ,
("%s", msg->reason_phrase),
("%s (%d), URL: %s", msg->reason_phrase, msg->status_code,
src->location));
}
src->ret = GST_FLOW_ERROR;
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment