mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-24 02:31:03 +00:00
souphttpsrc: properly check that seek range was respected
This check must be done only when we are sure the request was successfully sent. soup_session_send() might fail without setting the status code. In this case status code is 0 so we would only catch the error after the seek range check. In this case we would report an error saying that the seek range was not respected, instead of reporting the underlying error that triggered the soup_session_send() failure. https://bugzilla.gnome.org/attachment.cgi?bugid=777222
This commit is contained in:
parent
24b2422bf3
commit
c4cf67cfe5
1 changed files with 20 additions and 19 deletions
|
@ -1024,7 +1024,6 @@ gst_soup_http_src_got_headers (GstSoupHTTPSrc * src, SoupMessage * msg)
|
||||||
const char *value;
|
const char *value;
|
||||||
GstTagList *tag_list;
|
GstTagList *tag_list;
|
||||||
GstBaseSrc *basesrc;
|
GstBaseSrc *basesrc;
|
||||||
GstFlowReturn ret;
|
|
||||||
guint64 newsize;
|
guint64 newsize;
|
||||||
GHashTable *params = NULL;
|
GHashTable *params = NULL;
|
||||||
GstEvent *http_headers_event;
|
GstEvent *http_headers_event;
|
||||||
|
@ -1239,23 +1238,7 @@ gst_soup_http_src_got_headers (GstSoupHTTPSrc * src, SoupMessage * msg)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Handle HTTP errors. */
|
/* Handle HTTP errors. */
|
||||||
ret = gst_soup_http_src_parse_status (msg, src);
|
return gst_soup_http_src_parse_status (msg, src);
|
||||||
|
|
||||||
/* Check if Range header was respected. */
|
|
||||||
if (ret == GST_FLOW_CUSTOM_ERROR &&
|
|
||||||
src->read_position && msg->status_code != SOUP_STATUS_PARTIAL_CONTENT) {
|
|
||||||
src->seekable = FALSE;
|
|
||||||
GST_ELEMENT_ERROR_WITH_DETAILS (src, RESOURCE, SEEK,
|
|
||||||
(_("Server does not support seeking.")),
|
|
||||||
("Server does not accept Range HTTP header, URL: %s, Redirect to: %s",
|
|
||||||
src->location, GST_STR_NULL (src->redirection_uri)),
|
|
||||||
("http-status-code", G_TYPE_UINT, msg->status_code,
|
|
||||||
"http-redirection-uri", G_TYPE_STRING,
|
|
||||||
GST_STR_NULL (src->redirection_uri), NULL));
|
|
||||||
ret = GST_FLOW_ERROR;
|
|
||||||
}
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static GstBuffer *
|
static GstBuffer *
|
||||||
|
@ -1463,6 +1446,8 @@ gst_soup_http_src_send_message (GstSoupHTTPSrc * src)
|
||||||
static GstFlowReturn
|
static GstFlowReturn
|
||||||
gst_soup_http_src_do_request (GstSoupHTTPSrc * src, const gchar * method)
|
gst_soup_http_src_do_request (GstSoupHTTPSrc * src, const gchar * method)
|
||||||
{
|
{
|
||||||
|
GstFlowReturn ret;
|
||||||
|
|
||||||
if (src->max_retries != -1 && src->retry_count > src->max_retries) {
|
if (src->max_retries != -1 && src->retry_count > src->max_retries) {
|
||||||
GST_DEBUG_OBJECT (src, "Max retries reached");
|
GST_DEBUG_OBJECT (src, "Max retries reached");
|
||||||
return GST_FLOW_ERROR;
|
return GST_FLOW_ERROR;
|
||||||
|
@ -1492,7 +1477,23 @@ gst_soup_http_src_do_request (GstSoupHTTPSrc * src, const gchar * method)
|
||||||
return GST_FLOW_FLUSHING;
|
return GST_FLOW_FLUSHING;
|
||||||
}
|
}
|
||||||
|
|
||||||
return gst_soup_http_src_send_message (src);
|
ret = gst_soup_http_src_send_message (src);
|
||||||
|
|
||||||
|
/* Check if Range header was respected. */
|
||||||
|
if (ret == GST_FLOW_OK && src->request_position > 0 &&
|
||||||
|
src->msg->status_code != SOUP_STATUS_PARTIAL_CONTENT) {
|
||||||
|
src->seekable = FALSE;
|
||||||
|
GST_ELEMENT_ERROR_WITH_DETAILS (src, RESOURCE, SEEK,
|
||||||
|
(_("Server does not support seeking.")),
|
||||||
|
("Server does not accept Range HTTP header, URL: %s, Redirect to: %s",
|
||||||
|
src->location, GST_STR_NULL (src->redirection_uri)),
|
||||||
|
("http-status-code", G_TYPE_UINT, src->msg->status_code,
|
||||||
|
"http-redirection-uri", G_TYPE_STRING,
|
||||||
|
GST_STR_NULL (src->redirection_uri), NULL));
|
||||||
|
ret = GST_FLOW_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Reference in a new issue