From ad6fcea6b008638ca532436ecf8ba9fe7e41ffdd Mon Sep 17 00:00:00 2001 From: John Mark Bell Date: Sun, 3 Feb 2008 12:04:48 +0000 Subject: Add url_fragment to extract fragment from URL Optionally allow url_compare to ignore fragments in comparison Fix handling of url_compare result in a few places Fix redirects which contain fragments in the Location header svn path=/trunk/netsurf/; revision=3826 --- content/fetchcache.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'content/fetchcache.c') diff --git a/content/fetchcache.c b/content/fetchcache.c index b6b17a618..4fdbb93ca 100644 --- a/content/fetchcache.c +++ b/content/fetchcache.c @@ -689,6 +689,8 @@ void fetchcache_notmodified(struct content *c, const void *data) } content_remove_user(c, callback, p1, p2); + + msg_data.new_url = NULL; callback(CONTENT_MSG_NEWPTR, fb, p1, p2, msg_data); /* and catch user up with fallback's state */ @@ -786,25 +788,26 @@ void fetchcache_redirect(struct content *c, const void *data, { char *url, *url1; char *referer, *parent_url; - long http_code = fetch_http_code(c->fetch); - const char *ref = fetch_get_referer(c->fetch); - const char *parent = fetch_get_parent_url(c->fetch); + long http_code; + const char *ref; + const char *parent; union content_msg_data msg_data; url_func_result result; /* Preconditions */ assert(c && data); assert(c->status == CONTENT_STATUS_TYPE_UNKNOWN); - /* Ensure a redirect happened */ - assert(300 <= http_code && http_code <= 399); - /* 304 is handled by fetch_notmodified() */ - assert(http_code != 304); /* Extract fetch details */ http_code = fetch_http_code(c->fetch); ref = fetch_get_referer(c->fetch); parent = fetch_get_parent_url(c->fetch); + /* Ensure a redirect happened */ + assert(300 <= http_code && http_code <= 399); + /* 304 is handled by fetch_notmodified() */ + assert(http_code != 304); + /* Clone referer and parent url * originals are destroyed in fetch_abort() */ referer = ref ? strdup(ref) : NULL; @@ -941,6 +944,7 @@ void fetchcache_redirect(struct content *c, const void *data, replacement->redirect_count = c->redirect_count + 1; /* Notify user that content has changed */ + msg_data.new_url = url; callback(CONTENT_MSG_NEWPTR, replacement, p1, p2, msg_data); /* Start fetching the replacement content */ -- cgit v1.2.3