From: Sebastian Dröge Date: Mon, 28 Apr 2014 07:47:10 +0000 (+0200) Subject: souphttpsrc: Remember if a redirect is permanent or not and store it in the query X-Git-Tag: 1.3.1~40 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=3b6c17c2b68fbc9a22280b52241757c0ee185cec;p=platform%2Fupstream%2Fgst-plugins-good.git souphttpsrc: Remember if a redirect is permanent or not and store it in the query --- diff --git a/ext/soup/gstsouphttpsrc.c b/ext/soup/gstsouphttpsrc.c index 29ac120..c1cb542 100644 --- a/ext/soup/gstsouphttpsrc.c +++ b/ext/soup/gstsouphttpsrc.c @@ -965,8 +965,10 @@ gst_soup_http_src_got_headers_cb (SoupMessage * msg, GstSoupHTTPSrc * src) if (src->automatic_redirect && SOUP_STATUS_IS_REDIRECTION (msg->status_code)) { src->redirection_uri = g_strdup (soup_message_headers_get_one (msg->response_headers, "Location")); - GST_DEBUG_OBJECT (src, "%u redirect to \"%s\"", msg->status_code, - src->redirection_uri); + src->redirection_permanent = + (msg->status_code == SOUP_STATUS_MOVED_PERMANENTLY); + GST_DEBUG_OBJECT (src, "%u redirect to \"%s\" (permanent %d)", + msg->status_code, src->redirection_uri, src->redirection_permanent); return; } @@ -1793,8 +1795,11 @@ gst_soup_http_src_query (GstBaseSrc * bsrc, GstQuery * query) switch (GST_QUERY_TYPE (query)) { case GST_QUERY_URI: gst_query_set_uri (query, src->location); - if (src->redirection_uri != NULL) + if (src->redirection_uri != NULL) { gst_query_set_uri_redirection (query, src->redirection_uri); + gst_query_set_uri_redirection_permanent (query, + src->redirection_permanent); + } ret = TRUE; break; default: diff --git a/ext/soup/gstsouphttpsrc.h b/ext/soup/gstsouphttpsrc.h index 1aa68e0..77e1000 100644 --- a/ext/soup/gstsouphttpsrc.h +++ b/ext/soup/gstsouphttpsrc.h @@ -50,6 +50,7 @@ struct _GstSoupHTTPSrc { gchar *location; /* Full URI. */ gchar *redirection_uri; /* Full URI after redirections. */ + gboolean redirection_permanent; /* Permanent or temporary redirect? */ gchar *user_agent; /* User-Agent HTTP header. */ gboolean automatic_redirect; /* Follow redirects. */ SoupURI *proxy; /* HTTP proxy URI. */