From c00b142f4482a58bf3409c3375c29e8f33948926 Mon Sep 17 00:00:00 2001 From: Norbert Waschbuesch Date: Fri, 22 Jun 2012 21:56:52 +0000 Subject: [PATCH] souphttpsrc: error out properly when receiving data along with an error status When receiving an error code from the http server, such as 404, data might be sent along with it, like a web page. We don't want to output that data in this case, and we also want to pass the FLOW_ERROR return back to the base class, so it can stop properly. https://bugzilla.gnome.org/show_bug.cgi?id=678429 --- ext/soup/gstsouphttpsrc.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/ext/soup/gstsouphttpsrc.c b/ext/soup/gstsouphttpsrc.c index a5702a5..451bc62 100644 --- a/ext/soup/gstsouphttpsrc.c +++ b/ext/soup/gstsouphttpsrc.c @@ -804,6 +804,17 @@ gst_soup_http_src_got_headers_cb (SoupMessage * msg, GstSoupHTTPSrc * src) ("Server does not accept Range HTTP header, URL: %s", src->location)); src->ret = GST_FLOW_ERROR; } + + /* If we are going to error out, stop all processing right here, so we + * don't output any data (such as an error html page), and return + * GST_FLOW_ERROR from the create function instead of having + * got_chunk_cb overwrite src->ret with FLOW_OK again. */ + if (src->ret == GST_FLOW_ERROR) { + gst_soup_http_src_session_pause_message (src); + + if (src->loop) + g_main_loop_quit (src->loop); + } } /* Have body. Signal EOS. */ -- 2.7.4