summaryrefslogtreecommitdiff
path: root/desktop
diff options
context:
space:
mode:
authorJohn Mark Bell <jmb@netsurf-browser.org>2004-10-01 00:06:49 +0000
committerJohn Mark Bell <jmb@netsurf-browser.org>2004-10-01 00:06:49 +0000
commit39ad1632eb78e8c632d3e66711d09f2bb982a4e8 (patch)
tree63567b8dd3c363784021ef41f16ea3d716186054 /desktop
parent1202ad9c443dc5ac532b6b22d2b55fab019e08d9 (diff)
downloadnetsurf-39ad1632eb78e8c632d3e66711d09f2bb982a4e8.tar.gz
netsurf-39ad1632eb78e8c632d3e66711d09f2bb982a4e8.tar.bz2
[project @ 2004-10-01 00:06:49 by jmb]
Send HTTP referer header. This is _only_ sent when a link is clicked (theoretically, at least). svn path=/import/netsurf/; revision=1296
Diffstat (limited to 'desktop')
-rw-r--r--desktop/browser.c33
-rw-r--r--desktop/browser.h5
-rw-r--r--desktop/gui.h1
3 files changed, 23 insertions, 16 deletions
diff --git a/desktop/browser.c b/desktop/browser.c
index f0c5b38a6..791a76685 100644
--- a/desktop/browser.c
+++ b/desktop/browser.c
@@ -82,7 +82,8 @@ static void browser_form_submit(struct browser_window *bw, struct form *form,
/**
* Create and open a new browser window with the given page.
*
- * \param url URL to start fetching in the new window (copied)
+ * \param url URL to start fetching in the new window (copied)
+ * \param clone The browser window to clone
*/
void browser_window_create(const char *url, struct browser_window *clone)
@@ -105,22 +106,24 @@ void browser_window_create(const char *url, struct browser_window *clone)
free(bw);
return;
}
- browser_window_go(bw, url);
+ browser_window_go(bw, url, false);
}
/**
* Start fetching a page in a browser window.
*
- * \param bw browser window
- * \param url URL to start fetching (copied)
+ * \param bw browser window
+ * \param url URL to start fetching (copied)
+ * \param referer whether to send the referer header
*
* Any existing fetches in the window are aborted.
*/
-void browser_window_go(struct browser_window *bw, const char *url)
+void browser_window_go(struct browser_window *bw, const char *url,
+ bool referer)
{
- browser_window_go_post(bw, url, 0, 0, true);
+ browser_window_go_post(bw, url, 0, 0, true, referer);
}
@@ -144,7 +147,7 @@ void browser_window_go(struct browser_window *bw, const char *url)
void browser_window_go_post(struct browser_window *bw, const char *url,
char *post_urlenc,
struct form_successful_control *post_multipart,
- bool history_add)
+ bool history_add, bool referer)
{
struct content *c;
char *url2;
@@ -188,7 +191,8 @@ void browser_window_go_post(struct browser_window *bw, const char *url,
bw->loading_content = c;
browser_window_start_throbber(bw);
- fetchcache_go(c, 0, browser_window_callback, bw, 0,
+ fetchcache_go(c, referer ? gui_window_get_url(bw->window) : 0,
+ browser_window_callback, bw, 0,
post_urlenc, post_multipart, true);
}
@@ -273,7 +277,8 @@ void browser_window_callback(content_msg msg, struct content *c,
bw->loading_content = 0;
browser_window_set_status(bw,
messages_get("Redirecting"));
- browser_window_go(bw, data.redirect);
+ /* hmm, should we do send the referrer here? */
+ browser_window_go(bw, data.redirect, false);
break;
case CONTENT_MSG_REFORMAT:
@@ -469,7 +474,7 @@ void browser_window_reload(struct browser_window *bw, bool all)
}
}
bw->current_content->fresh = false;
- browser_window_go_post(bw, bw->current_content->url, 0, 0, false);
+ browser_window_go_post(bw, bw->current_content->url, 0, 0, false, false);
}
@@ -783,7 +788,7 @@ void browser_window_mouse_click_html(struct browser_window *bw,
click == BROWSER_MOUSE_CLICK_2) {
if (fetch_can_fetch(url)) {
if (click == BROWSER_MOUSE_CLICK_1)
- browser_window_go(bw, url);
+ browser_window_go(bw, url, true);
else
browser_window_create(url, bw);
} else {
@@ -1721,7 +1726,7 @@ void browser_form_submit(struct browser_window *bw, struct form *form,
res = url_join(url, base, &url1);
if (res != URL_FUNC_OK)
break;
- browser_window_go(bw, url1);
+ browser_window_go(bw, url1, true);
break;
case method_POST_URLENC:
@@ -1734,14 +1739,14 @@ void browser_form_submit(struct browser_window *bw, struct form *form,
res = url_join(form->action, base, &url);
if (res != URL_FUNC_OK)
break;
- browser_window_go_post(bw, url, data, 0, true);
+ browser_window_go_post(bw, url, data, 0, true, true);
break;
case method_POST_MULTIPART:
res = url_join(form->action, base, &url);
if (res != URL_FUNC_OK)
break;
- browser_window_go_post(bw, url, 0, success, true);
+ browser_window_go_post(bw, url, 0, success, true, true);
break;
default:
diff --git a/desktop/browser.h b/desktop/browser.h
index ba0bd0e04..7978060ef 100644
--- a/desktop/browser.h
+++ b/desktop/browser.h
@@ -71,11 +71,12 @@ typedef enum {
void browser_window_create(const char *url, struct browser_window *clone);
-void browser_window_go(struct browser_window *bw, const char *url);
+void browser_window_go(struct browser_window *bw, const char *url,
+ bool referer);
void browser_window_go_post(struct browser_window *bw, const char *url,
char *post_urlenc,
struct form_successful_control *post_multipart,
- bool history_add);
+ bool history_add, bool referer);
void browser_window_stop(struct browser_window *bw);
void browser_window_reload(struct browser_window *bw, bool all);
void browser_window_destroy(struct browser_window *bw);
diff --git a/desktop/gui.h b/desktop/gui.h
index 1db455c6f..cb16e8864 100644
--- a/desktop/gui.h
+++ b/desktop/gui.h
@@ -45,6 +45,7 @@ void gui_window_set_extent(struct gui_window *g, int width, int height);
void gui_window_set_status(struct gui_window *g, const char *text);
void gui_window_set_pointer(gui_pointer_shape shape);
void gui_window_set_url(struct gui_window *g, const char *url);
+char *gui_window_get_url(struct gui_window *g);
void gui_window_start_throbber(struct gui_window *g);
void gui_window_stop_throbber(struct gui_window *g);
void gui_window_place_caret(struct gui_window *g, int x, int y, int height);