diff options
author | Wouter Cloetens <wouter@mind.be> | 2008-02-26 05:36:17 +0000 |
---|---|---|
committer | Sebastian Dröge <slomo@circular-chaos.org> | 2008-02-26 05:36:17 +0000 |
commit | 72f07c778ea00370f454bda53e2c1178d4a96ff9 (patch) | |
tree | c8f852ccbb485ca2032900021058e25b1e8878e1 /ext | |
parent | 188190e0e88869d6c5e1097518715f90b5b74169 (diff) | |
download | gstreamer-plugins-bad-72f07c778ea00370f454bda53e2c1178d4a96ff9.tar.gz |
Add support for specifying a list of cookies to be passed in the HTTP request. Fixes bug #518722.
Original commit message from CVS:
Patch by: Wouter Cloetens <wouter at mind dot be>
* ext/soup/gstsouphttpsrc.c: (gst_soup_http_src_class_init),
(gst_soup_http_src_init), (gst_soup_http_src_dispose),
(gst_soup_http_src_set_property), (gst_soup_http_src_get_property),
(gst_soup_http_src_create):
* ext/soup/gstsouphttpsrc.h:
* tests/check/elements/souphttpsrc.c: (run_test), (GST_START_TEST),
(souphttpsrc_suite):
Add support for specifying a list of cookies to be passed in
the HTTP request. Fixes bug #518722.
Diffstat (limited to 'ext')
-rw-r--r-- | ext/soup/gstsouphttpsrc.c | 21 | ||||
-rw-r--r-- | ext/soup/gstsouphttpsrc.h | 1 |
2 files changed, 22 insertions, 0 deletions
diff --git a/ext/soup/gstsouphttpsrc.c b/ext/soup/gstsouphttpsrc.c index af50eaa23..3e2326dec 100644 --- a/ext/soup/gstsouphttpsrc.c +++ b/ext/soup/gstsouphttpsrc.c @@ -117,6 +117,7 @@ enum PROP_USER_AGENT, PROP_AUTOMATIC_REDIRECT, PROP_PROXY, + PROP_COOKIES, PROP_IRADIO_MODE, PROP_IRADIO_NAME, PROP_IRADIO_GENRE, @@ -240,6 +241,9 @@ gst_soup_http_src_class_init (GstSoupHTTPSrcClass * klass) PROP_PROXY, g_param_spec_string ("proxy", "Proxy", "HTTP proxy server URI", "", G_PARAM_READWRITE)); + g_object_class_install_property (gobject_class, + PROP_COOKIES, g_param_spec_boxed ("cookies", "Cookies", + "HTTP request cookies", G_TYPE_STRV, G_PARAM_READWRITE)); /* icecast stuff */ g_object_class_install_property (gobject_class, @@ -291,6 +295,7 @@ gst_soup_http_src_init (GstSoupHTTPSrc * src, GstSoupHTTPSrcClass * g_class) src->location = NULL; src->automatic_redirect = TRUE; src->user_agent = g_strdup (DEFAULT_USER_AGENT); + src->cookies = NULL; src->icy_caps = NULL; src->iradio_mode = FALSE; src->iradio_name = NULL; @@ -328,6 +333,7 @@ gst_soup_http_src_dispose (GObject * gobject) soup_uri_free (src->proxy); src->proxy = NULL; } + g_strfreev (src->cookies); g_free (src->iradio_name); src->iradio_name = NULL; g_free (src->iradio_genre); @@ -397,6 +403,10 @@ gst_soup_http_src_set_property (GObject * object, guint prop_id, } break; } + case PROP_COOKIES: + g_strfreev (src->cookies); + src->cookies = g_strdupv (g_value_get_boxed (value)); + break; } done: return; @@ -428,6 +438,9 @@ gst_soup_http_src_get_property (GObject * object, guint prop_id, free (proxy); } break; + case PROP_COOKIES: + g_value_set_boxed (value, g_strdupv (src->cookies)); + break; case PROP_IRADIO_MODE: g_value_set_boolean (value, src->iradio_mode); break; @@ -860,6 +873,14 @@ gst_soup_http_src_create (GstPushSrc * psrc, GstBuffer ** outbuf) soup_message_headers_append (src->msg->request_headers, "icy-metadata", "1"); } + if (src->cookies) { + gchar **cookie; + + for (cookie = src->cookies; *cookie != NULL; cookie++) { + soup_message_headers_append (src->msg->request_headers, "Cookie", + *cookie); + } + } g_signal_connect (src->msg, "got_headers", G_CALLBACK (gst_soup_http_src_got_headers_cb), src); diff --git a/ext/soup/gstsouphttpsrc.h b/ext/soup/gstsouphttpsrc.h index 9e7d81cb7..5bad737d8 100644 --- a/ext/soup/gstsouphttpsrc.h +++ b/ext/soup/gstsouphttpsrc.h @@ -51,6 +51,7 @@ struct _GstSoupHTTPSrc { gchar *user_agent; /* User-Agent HTTP header. */ gboolean automatic_redirect; /* Follow redirects. */ SoupURI *proxy; /* HTTP proxy URI. */ + gchar **cookies; /* HTTP request cookies. */ GMainContext *context; /* I/O context. */ GMainLoop *loop; /* Event loop. */ SoupSession *session; /* Async context. */ |