diff options
author | Mario Sanchez Prada <msanchez@igalia.com> | 2010-04-15 00:06:36 +0800 |
---|---|---|
committer | Xan Lopez <xan@gnome.org> | 2010-04-17 02:57:40 +0800 |
commit | b30cf3d0e24c51b0f77979af49f200bbac5bd050 (patch) | |
tree | eb54b1760076c6b32a724c4f4e82628b44bd6ca0 /embed | |
parent | 7f5202b49a8015bc09faa6e10c9f78c3e97ab83b (diff) | |
download | gsoc2013-epiphany-b30cf3d0e24c51b0f77979af49f200bbac5bd050.tar.gz gsoc2013-epiphany-b30cf3d0e24c51b0f77979af49f200bbac5bd050.tar.zst gsoc2013-epiphany-b30cf3d0e24c51b0f77979af49f200bbac5bd050.zip |
Send 'Referer' on headers sent for context menu HTTP downloads
Make sure the EphyEmbedPersist object is created specifying the
EphyEmbed object, and create the network request inside of it
using the URL from the associated web view as 'Referer'
Bug #136292
Signed-off-by: Xan Lopez <xan@gnome.org>
Diffstat (limited to 'embed')
-rw-r--r-- | embed/ephy-embed-persist.c | 31 |
1 files changed, 30 insertions, 1 deletions
diff --git a/embed/ephy-embed-persist.c b/embed/ephy-embed-persist.c index 44910fe9c..8ee3df39e 100644 --- a/embed/ephy-embed-persist.c +++ b/embed/ephy-embed-persist.c @@ -763,7 +763,36 @@ ephy_embed_persist_save (EphyEmbedPersist *persist) */ g_object_ref (persist); - request = webkit_network_request_new (priv->source); + if (priv->embed) + { + EphyWebView *web_view; + SoupMessage *msg; + gchar *referer; + + /* Get the webview associated to the embed */ + web_view = ephy_embed_get_web_view (priv->embed); + + /* Create the request with a SoupMessage to allow + setting the 'Referer' as got from the embed */ + msg = soup_message_new (SOUP_METHOD_GET, priv->source); + request = WEBKIT_NETWORK_REQUEST ( + g_object_new (WEBKIT_TYPE_NETWORK_REQUEST, + "message", msg, + NULL)); + + /* Add the referer to the request headers */ + referer = ephy_web_view_get_location (web_view, FALSE); + soup_message_headers_append (msg->request_headers, + "Referer", referer); + g_free (referer); + g_object_unref (msg); + } + else + { + /* Create a normal network request otherwise */ + request = webkit_network_request_new (priv->source); + } + priv->download = webkit_download_new (request); g_object_unref (request); |