Commit 8586150a authored by Edward Hervey's avatar Edward Hervey Committed by Edward Hervey

souphttpsrc: Make more usage of error macro

And make sure we actually use the provided soup_msg argument in the macro
parent b7434f8d
......@@ -1248,7 +1248,7 @@ gst_soup_http_src_alloc_buffer (GstSoupHTTPSrc * src)
GST_ELEMENT_ERROR_WITH_DETAILS ((src), cat, code, ("%s", error_message), \
("%s (%d), URL: %s, Redirect to: %s", (soup_msg)->reason_phrase, \
(soup_msg)->status_code, (src)->location, GST_STR_NULL ((src)->redirection_uri)), \
("http-status-code", G_TYPE_UINT, msg->status_code, \
("http-status-code", G_TYPE_UINT, (soup_msg)->status_code, \
"http-redirect-uri", G_TYPE_STRING, GST_STR_NULL ((src)->redirection_uri), NULL)); \
} while(0)
......@@ -1323,33 +1323,14 @@ gst_soup_http_src_parse_status (SoupMessage * msg, GstSoupHTTPSrc * src)
* error dialog according to libsoup documentation.
*/
if (msg->status_code == SOUP_STATUS_NOT_FOUND) {
GST_ELEMENT_ERROR_WITH_DETAILS (src, RESOURCE, NOT_FOUND,
("%s", reason_phrase),
("%s (%d), URL: %s, Redirect to: %s", reason_phrase,
msg->status_code, src->location,
GST_STR_NULL (src->redirection_uri)),
("http-status-code", G_TYPE_UINT, msg->status_code,
"http-redirect-uri", G_TYPE_STRING,
GST_STR_NULL (src->redirection_uri), NULL));
SOUP_HTTP_SRC_ERROR (src, msg, RESOURCE, NOT_FOUND, (reason_phrase));
} 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_WITH_DETAILS (src, RESOURCE, NOT_AUTHORIZED, ("%s",
reason_phrase), ("%s (%d), URL: %s, Redirect to: %s",
reason_phrase, msg->status_code, src->location,
GST_STR_NULL (src->redirection_uri)), ("http-status-code",
G_TYPE_UINT, msg->status_code, "http-redirect-uri", G_TYPE_STRING,
GST_STR_NULL (src->redirection_uri), NULL));
SOUP_HTTP_SRC_ERROR (src, msg, RESOURCE, NOT_AUTHORIZED, (reason_phrase));
} else {
GST_ELEMENT_ERROR_WITH_DETAILS (src, RESOURCE, OPEN_READ,
("%s", reason_phrase),
("%s (%d), URL: %s, Redirect to: %s", reason_phrase,
msg->status_code, src->location,
GST_STR_NULL (src->redirection_uri)),
("http-status-code", G_TYPE_UINT, msg->status_code,
"http-redirect-uri", G_TYPE_STRING,
GST_STR_NULL (src->redirection_uri), NULL));
SOUP_HTTP_SRC_ERROR (src, msg, RESOURCE, OPEN_READ, (reason_phrase));
}
return 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