From: Andoni Morales Alastruey Date: Fri, 12 Jul 2013 23:50:56 +0000 (+0200) Subject: souphttpsrc: add redirection to the URI query X-Git-Tag: 1.19.3~509^2~5460 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b9faeab236f36d69a264c42632577e59564c0be1;p=platform%2Fupstream%2Fgstreamer.git souphttpsrc: add redirection to the URI query --- diff --git a/ext/soup/gstsouphttpsrc.c b/ext/soup/gstsouphttpsrc.c index fb92262..bd4c911 100644 --- a/ext/soup/gstsouphttpsrc.c +++ b/ext/soup/gstsouphttpsrc.c @@ -299,6 +299,7 @@ gst_soup_http_src_init (GstSoupHTTPSrc * src) g_mutex_init (&src->mutex); g_cond_init (&src->request_finished_cond); src->location = NULL; + src->redirection_uri = NULL; src->automatic_redirect = TRUE; src->user_agent = g_strdup (DEFAULT_USER_AGENT); src->user_id = NULL; @@ -331,6 +332,9 @@ gst_soup_http_src_finalize (GObject * gobject) g_mutex_clear (&src->mutex); g_cond_clear (&src->request_finished_cond); g_free (src->location); + if (src->redirection_uri) { + g_free (src->redirection_uri); + } g_free (src->user_agent); if (src->proxy != NULL) { soup_uri_free (src->proxy); @@ -744,8 +748,10 @@ gst_soup_http_src_got_headers_cb (SoupMessage * msg, GstSoupHTTPSrc * src) return; if (src->automatic_redirect && SOUP_STATUS_IS_REDIRECTION (msg->status_code)) { + src->redirection_uri = g_strdup (soup_message_headers_get + (msg->response_headers, "Location")); GST_DEBUG_OBJECT (src, "%u redirect to \"%s\"", msg->status_code, - soup_message_headers_get_one (msg->response_headers, "Location")); + src->redirection_uri); return; } @@ -1460,6 +1466,7 @@ 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); + gst_query_set_uri_redirection (query, src->redirection_uri); ret = TRUE; break; default: @@ -1506,6 +1513,11 @@ gst_soup_http_src_set_location (GstSoupHTTPSrc * src, const gchar * uri, } } + if (src->redirection_uri) { + g_free (src->redirection_uri); + src->redirection_uri = NULL; + } + src->location = g_strdup (uri); return TRUE; diff --git a/ext/soup/gstsouphttpsrc.h b/ext/soup/gstsouphttpsrc.h index 9ccc35a..594dfaa 100644 --- a/ext/soup/gstsouphttpsrc.h +++ b/ext/soup/gstsouphttpsrc.h @@ -49,6 +49,7 @@ struct _GstSoupHTTPSrc { GstPushSrc element; gchar *location; /* Full URI. */ + gchar *redirection_uri; /* Full URI after redirections. */ gchar *user_agent; /* User-Agent HTTP header. */ gboolean automatic_redirect; /* Follow redirects. */ SoupURI *proxy; /* HTTP proxy URI. */