From 484eaf8297672c2ed07a4406b4a1bc35c881fb22 Mon Sep 17 00:00:00 2001 From: James Bursa Date: Tue, 1 Jul 2003 20:36:28 +0000 Subject: [project @ 2003-07-01 20:36:28 by bursa] Handle relative redirects. svn path=/import/netsurf/; revision=197 --- content/fetchcache.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/content/fetchcache.c b/content/fetchcache.c index 8f267f70f..ebd5e66d1 100644 --- a/content/fetchcache.c +++ b/content/fetchcache.c @@ -56,6 +56,7 @@ void fetchcache_callback(fetch_msg msg, void *p, char *data, unsigned long size) content_type type; char *mime_type; char *semic; + char *url; switch (msg) { case FETCH_TYPE: @@ -95,7 +96,11 @@ void fetchcache_callback(fetch_msg msg, void *p, char *data, unsigned long size) case FETCH_REDIRECT: LOG(("FETCH_REDIRECT, '%s'", data)); c->fetch = 0; - content_broadcast(c, CONTENT_MSG_REDIRECT, data); + /* redirect URLs must be absolute by HTTP/1.1, but many sites send + * relative ones: treat them as relative to requested URL */ + url = url_join(data, c->url); + content_broadcast(c, CONTENT_MSG_REDIRECT, url); + xfree(url); cache_destroy(c); content_destroy(c); break; -- cgit v1.2.3