souphttpsrc: Make more usage of error macro

And make sure we actually use the provided soup_msg argument in the macro
This commit is contained in:
Edward Hervey 2017-04-13 08:00:30 +02:00 committed by Edward Hervey
parent b7434f8d9c
commit 8586150aec

View file

@ -1248,7 +1248,7 @@ gst_soup_http_src_alloc_buffer (GstSoupHTTPSrc * src)
GST_ELEMENT_ERROR_WITH_DETAILS ((src), cat, code, ("%s", error_message), \ GST_ELEMENT_ERROR_WITH_DETAILS ((src), cat, code, ("%s", error_message), \
("%s (%d), URL: %s, Redirect to: %s", (soup_msg)->reason_phrase, \ ("%s (%d), URL: %s, Redirect to: %s", (soup_msg)->reason_phrase, \
(soup_msg)->status_code, (src)->location, GST_STR_NULL ((src)->redirection_uri)), \ (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)); \ "http-redirect-uri", G_TYPE_STRING, GST_STR_NULL ((src)->redirection_uri), NULL)); \
} while(0) } while(0)
@ -1323,33 +1323,14 @@ gst_soup_http_src_parse_status (SoupMessage * msg, GstSoupHTTPSrc * src)
* error dialog according to libsoup documentation. * error dialog according to libsoup documentation.
*/ */
if (msg->status_code == SOUP_STATUS_NOT_FOUND) { if (msg->status_code == SOUP_STATUS_NOT_FOUND) {
GST_ELEMENT_ERROR_WITH_DETAILS (src, RESOURCE, NOT_FOUND, SOUP_HTTP_SRC_ERROR (src, msg, RESOURCE, NOT_FOUND, (reason_phrase));
("%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));
} else if (msg->status_code == SOUP_STATUS_UNAUTHORIZED } else if (msg->status_code == SOUP_STATUS_UNAUTHORIZED
|| msg->status_code == SOUP_STATUS_PAYMENT_REQUIRED || msg->status_code == SOUP_STATUS_PAYMENT_REQUIRED
|| msg->status_code == SOUP_STATUS_FORBIDDEN || msg->status_code == SOUP_STATUS_FORBIDDEN
|| msg->status_code == SOUP_STATUS_PROXY_AUTHENTICATION_REQUIRED) { || msg->status_code == SOUP_STATUS_PROXY_AUTHENTICATION_REQUIRED) {
GST_ELEMENT_ERROR_WITH_DETAILS (src, RESOURCE, NOT_AUTHORIZED, ("%s", SOUP_HTTP_SRC_ERROR (src, msg, RESOURCE, NOT_AUTHORIZED, (reason_phrase));
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));
} else { } else {
GST_ELEMENT_ERROR_WITH_DETAILS (src, RESOURCE, OPEN_READ, SOUP_HTTP_SRC_ERROR (src, msg, RESOURCE, OPEN_READ, (reason_phrase));
("%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));
} }
return GST_FLOW_ERROR; return GST_FLOW_ERROR;
} }