From: Sebastian Dröge Date: Thu, 6 Mar 2014 12:35:47 +0000 (+0100) Subject: souphttpsrc: If we had a stop position, allow for the server to finish our connection... X-Git-Tag: 1.19.3~509^2~4765 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=0c6f1ce9988f1f781b70d6461164df30d16dc23c;p=platform%2Fupstream%2Fgstreamer.git souphttpsrc: If we had a stop position, allow for the server to finish our connection instead of just cancelling Otherwise keep-alive does not make much sense and also the server will have confusing things in the logs. --- diff --git a/ext/soup/gstsouphttpsrc.c b/ext/soup/gstsouphttpsrc.c index 5fcf8bc..8ffbb48 100644 --- a/ext/soup/gstsouphttpsrc.c +++ b/ext/soup/gstsouphttpsrc.c @@ -1159,6 +1159,13 @@ gst_soup_http_src_got_chunk_cb (SoupMessage * msg, SoupBuffer * chunk, GST_DEBUG_OBJECT (src, "got chunk, but not for current message"); return; } + if (G_UNLIKELY (!src->outbuf)) { + GST_DEBUG_OBJECT (src, "got chunk but we're not expecting one"); + src->ret = GST_FLOW_OK; + gst_soup_http_src_cancel_message (src); + return; + } + src->have_body = FALSE; if (G_UNLIKELY (src->session_io_status != GST_SOUP_HTTP_SRC_SESSION_IO_STATUS_RUNNING)) { @@ -1426,11 +1433,21 @@ gst_soup_http_src_do_request (GstSoupHTTPSrc * src, const gchar * method, if (src->ret == GST_FLOW_CUSTOM_ERROR) g_main_loop_run (src->loop); + } while (src->ret == GST_FLOW_CUSTOM_ERROR); + /* Let the request finish if we had a stop position and are there */ + if (src->ret == GST_FLOW_OK && src->stop_position != -1 + && src->read_position >= src->stop_position) { + src->outbuf = NULL; + gst_soup_http_src_session_unpause_message (src); + g_main_loop_run (src->loop); + } + if (src->ret == GST_FLOW_CUSTOM_ERROR) src->ret = GST_FLOW_EOS; g_cond_signal (&src->request_finished_cond); + return src->ret; }