From: Thiago Santos Date: Thu, 11 Jul 2013 23:41:23 +0000 (-0300) Subject: souphttpsrc: ignore errors from HEAD request X-Git-Tag: 1.1.3~109 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=9a7321872f6902dd829599aab02f193eec307ac7;p=platform%2Fupstream%2Fgst-plugins-good.git souphttpsrc: ignore errors from HEAD request HEAD requests are used to check the server headers to see if it seekable. Ignore errors from those requests as they shouldn't be critical. https://bugzilla.gnome.org/show_bug.cgi?id=704053 --- diff --git a/ext/soup/gstsouphttpsrc.c b/ext/soup/gstsouphttpsrc.c index 79f6109..b7f6de0 100644 --- a/ext/soup/gstsouphttpsrc.c +++ b/ext/soup/gstsouphttpsrc.c @@ -937,10 +937,15 @@ gst_soup_http_src_finished_cb (SoupMessage * msg, GstSoupHTTPSrc * src) src->ret = GST_FLOW_CUSTOM_ERROR; } else if (G_UNLIKELY (src->session_io_status != GST_SOUP_HTTP_SRC_SESSION_IO_STATUS_RUNNING)) { - /* FIXME: reason_phrase is not translated, add proper error message */ - GST_ELEMENT_ERROR (src, RESOURCE, NOT_FOUND, - ("%s", msg->reason_phrase), - ("libsoup status code %d", msg->status_code)); + if (msg->method == SOUP_METHOD_HEAD) { + GST_DEBUG_OBJECT (src, "Ignoring error %d:%s during HEAD request", + msg->status_code, msg->reason_phrase); + } else { + /* FIXME: reason_phrase is not translated, add proper error message */ + GST_ELEMENT_ERROR (src, RESOURCE, NOT_FOUND, + ("%s", msg->reason_phrase), + ("libsoup status code %d", msg->status_code)); + } } if (src->loop) g_main_loop_quit (src->loop); @@ -1112,38 +1117,43 @@ static void gst_soup_http_src_parse_status (SoupMessage * msg, GstSoupHTTPSrc * src) { if (SOUP_STATUS_IS_TRANSPORT_ERROR (msg->status_code)) { - switch (msg->status_code) { - case SOUP_STATUS_CANT_RESOLVE: - case SOUP_STATUS_CANT_RESOLVE_PROXY: - SOUP_HTTP_SRC_ERROR (src, msg, RESOURCE, NOT_FOUND, - _("Could not resolve server name.")); - src->ret = GST_FLOW_ERROR; - break; - case SOUP_STATUS_CANT_CONNECT: - case SOUP_STATUS_CANT_CONNECT_PROXY: - SOUP_HTTP_SRC_ERROR (src, msg, RESOURCE, OPEN_READ, - _("Could not establish connection to server.")); - src->ret = GST_FLOW_ERROR; - break; - case SOUP_STATUS_SSL_FAILED: - SOUP_HTTP_SRC_ERROR (src, msg, RESOURCE, OPEN_READ, - _("Secure connection setup failed.")); - src->ret = GST_FLOW_ERROR; - break; - case SOUP_STATUS_IO_ERROR: - SOUP_HTTP_SRC_ERROR (src, msg, RESOURCE, READ, - _("A network error occured, or the server closed the connection " - "unexpectedly.")); - src->ret = GST_FLOW_ERROR; - break; - case SOUP_STATUS_MALFORMED: - SOUP_HTTP_SRC_ERROR (src, msg, RESOURCE, READ, - _("Server sent bad data.")); - src->ret = GST_FLOW_ERROR; - break; - case SOUP_STATUS_CANCELLED: - /* No error message when interrupted by program. */ - break; + if (msg->method == SOUP_METHOD_HEAD) { + GST_DEBUG_OBJECT (src, "Ignoring error %d during HEAD request", + msg->status_code); + } else { + switch (msg->status_code) { + case SOUP_STATUS_CANT_RESOLVE: + case SOUP_STATUS_CANT_RESOLVE_PROXY: + SOUP_HTTP_SRC_ERROR (src, msg, RESOURCE, NOT_FOUND, + _("Could not resolve server name.")); + src->ret = GST_FLOW_ERROR; + break; + case SOUP_STATUS_CANT_CONNECT: + case SOUP_STATUS_CANT_CONNECT_PROXY: + SOUP_HTTP_SRC_ERROR (src, msg, RESOURCE, OPEN_READ, + _("Could not establish connection to server.")); + src->ret = GST_FLOW_ERROR; + break; + case SOUP_STATUS_SSL_FAILED: + SOUP_HTTP_SRC_ERROR (src, msg, RESOURCE, OPEN_READ, + _("Secure connection setup failed.")); + src->ret = GST_FLOW_ERROR; + break; + case SOUP_STATUS_IO_ERROR: + SOUP_HTTP_SRC_ERROR (src, msg, RESOURCE, READ, + _("A network error occured, or the server closed the connection " + "unexpectedly.")); + src->ret = GST_FLOW_ERROR; + break; + case SOUP_STATUS_MALFORMED: + SOUP_HTTP_SRC_ERROR (src, msg, RESOURCE, READ, + _("Server sent bad data.")); + src->ret = GST_FLOW_ERROR; + break; + case SOUP_STATUS_CANCELLED: + /* No error message when interrupted by program. */ + break; + } } } else if (SOUP_STATUS_IS_CLIENT_ERROR (msg->status_code) || SOUP_STATUS_IS_REDIRECTION (msg->status_code) ||