diff options
author | Michael Drake <tlsa@netsurf-browser.org> | 2013-05-27 14:51:00 +0100 |
---|---|---|
committer | Michael Drake <tlsa@netsurf-browser.org> | 2013-05-27 14:51:00 +0100 |
commit | ba9769bc8c22c49fe1be6536d4684661ea2e079b (patch) | |
tree | c7a3355fb2d84bb21608dc85d12e8de4662eb787 /content/llcache.c | |
parent | 8dc7ec2cb48d74a6fd808f6989ec08771f4bb98f (diff) | |
download | netsurf-ba9769bc8c22c49fe1be6536d4684661ea2e079b.tar.gz netsurf-ba9769bc8c22c49fe1be6536d4684661ea2e079b.tar.bz2 |
Pass fetch redirect info up to content layer as content_msg. Mark redirect origin URLs as visited in browser window content callback. Note this doesn't mean we track redirects, it just lets us get the :visited link style on links that redirect.
Diffstat (limited to 'content/llcache.c')
-rw-r--r-- | content/llcache.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/content/llcache.c b/content/llcache.c index 938f1e8f6..f2e519f49 100644 --- a/content/llcache.c +++ b/content/llcache.c @@ -1224,6 +1224,7 @@ static nserror llcache_fetch_redirect(llcache_object *object, const char *target bool match; /* Extract HTTP response code from the fetch object */ long http_code = fetch_http_code(object->fetch.fetch); + llcache_event event; /* Abort fetch for this object */ fetch_abort(object->fetch.fetch); @@ -1238,8 +1239,6 @@ static nserror llcache_fetch_redirect(llcache_object *object, const char *target /* Forcibly stop redirecting if we've followed too many redirects */ #define REDIRECT_LIMIT 10 if (object->fetch.redirect_count > REDIRECT_LIMIT) { - llcache_event event; - LOG(("Too many nested redirects")); event.type = LLCACHE_EVENT_ERROR; @@ -1254,6 +1253,18 @@ static nserror llcache_fetch_redirect(llcache_object *object, const char *target if (error != NSERROR_OK) return error; + /* Inform users of redirect */ + event.type = LLCACHE_EVENT_REDIRECT; + event.data.redirect.from = object->url; + event.data.redirect.to = url; + + error = llcache_send_event_to_users(object, &event); + + if (error != NSERROR_OK) { + nsurl_unref(url); + return error; + } + /* Reject attempts to redirect from unvalidated to validated schemes * A "validated" scheme is one over which we have some guarantee that * the source is trustworthy. */ |