diff options
-rw-r--r-- | embed/ephy-embed-persist.c | 31 | ||||
-rw-r--r-- | src/popup-commands.c | 1 |
2 files changed, 31 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); diff --git a/src/popup-commands.c b/src/popup-commands.c index 8930d834c..c620d08df 100644 --- a/src/popup-commands.c +++ b/src/popup-commands.c @@ -237,6 +237,7 @@ save_property_url (GtkAction *action, ephy_embed_persist_set_persist_key (persist, CONF_STATE_SAVE_DIR); ephy_embed_persist_set_source (persist, location); + ephy_embed_persist_set_embed (persist, embed); g_signal_connect (persist, "completed", G_CALLBACK (save_property_url_completed_cb), NULL); |