Fix a regression introduced by commit
183695c61a54f1 (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.
https://bugzilla.gnome.org/show_bug.cgi?id=776720
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,
src->stop_position);
}
}
} 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 */
ret = GST_FLOW_CUSTOM_ERROR;
} else {