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
This commit is contained in:
Norbert Waschbuesch 2012-06-22 21:56:52 +00:00 committed by Tim-Philipp Müller
parent aa10487795
commit c00b142f44

View file

@ -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. */