summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThiago Santos <thiagoss@osg.samsung.com>2015-11-10 15:36:31 -0300
committerThiago Santos <thiagoss@osg.samsung.com>2016-01-19 15:35:08 -0300
commit324de26ccf0e2e6855aeba673520c538f5f7617d (patch)
tree25bc5f700c8ee333a31e0b683120581122e0718f
parent0a5c809a0eda3d5c66ae03397f192d29c1172d62 (diff)
souphttpsrc: share the cookiejar in the context, not the cookiescookies
The cookies can mutate at every request and it would need proper tracking to keep updating the context and then copying it back to the soup cookie jar. It is easier to let the cookiejar be shared and handle it directly there. Other http source implementations can do the same with their cookiejar implementations
-rw-r--r--ext/soup/gstsouphttpsrc.c20
1 files changed, 4 insertions, 16 deletions
diff --git a/ext/soup/gstsouphttpsrc.c b/ext/soup/gstsouphttpsrc.c
index b2eaa6f3a..1c011c5bd 100644
--- a/ext/soup/gstsouphttpsrc.c
+++ b/ext/soup/gstsouphttpsrc.c
@@ -2091,10 +2091,7 @@ gst_soup_http_src_query (GstBaseSrc * bsrc, GstQuery * query)
gint minsize, maxsize, align;
GstContext *context;
GstStructure *context_structure;
- char *cookie;
- const gchar *cookies[2];
const gchar *context_type;
- SoupURI *uri;
switch (GST_QUERY_TYPE (query)) {
case GST_QUERY_URI:
@@ -2108,21 +2105,12 @@ gst_soup_http_src_query (GstBaseSrc * bsrc, GstQuery * query)
break;
case GST_QUERY_CONTEXT:
if (gst_query_parse_context_type (query, &context_type)
- && !g_strcmp0 (context_type, "http-headers")) {
- uri = soup_uri_new (src->location);
- cookie = soup_cookie_jar_get_cookies (src->cookie_jar, uri, TRUE);
- context = gst_context_new ("http-headers", FALSE);
- gst_context_make_writable (context);
+ && !g_strcmp0 (context_type, "soup-http") && src->cookie_jar) {
+ context = gst_context_new ("soup-http", FALSE);
context_structure = gst_context_writable_structure (context);
- if (cookie != NULL) {
- cookies[0] = cookie;
- cookies[1] = NULL;
- gst_structure_set (context_structure, "cookies", G_TYPE_STRV, cookies,
- NULL);
- g_free (cookie);
- }
+ gst_structure_set (context_structure, "soup-cookie-jar", G_TYPE_OBJECT,
+ src->cookie_jar, NULL);
gst_query_set_context (query, context);
- soup_uri_free (uri);
ret = TRUE;
break;
}