Commit 03db3741 authored by Arnaud Vrac's avatar Arnaud Vrac Committed by Sebastian Dröge
Browse files

souphttpsrc: retry request on early termination from the server

Fix a regression introduced by commit 183695c6 (refactor to use
Soup's sync API). The code previously attempted to reconnect when the
server closed the connection early, for example when the stream was put
in pause for some time.

Reintroduce this feature by checking if EOS is received before the
expected content size is downloaded. In this case, do the request
starting at the previous read position.
parent a8eb0515
......@@ -1467,7 +1467,7 @@ gst_soup_http_src_do_request (GstSoupHTTPSrc * src, const gchar * method)
GST_LOG_OBJECT (src, "Running request for method: %s", method);
/* Update the position if we are retrying */
if (src->msg && (src->request_position != src->read_position)) {
if (src->msg && src->request_position > 0) {
gst_soup_http_src_add_range_header (src, src->request_position,
......@@ -1637,7 +1637,8 @@ gst_soup_http_src_read_buffer (GstSoupHTTPSrc * src, GstBuffer ** outbuf)
} else {
gst_buffer_unref (*outbuf);
if (read_bytes < 0) {
if (read_bytes < 0 ||
(src->have_size && src->read_position < src->content_size)) {
/* Maybe the server disconnected, retry */
} else {
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