summaryrefslogtreecommitdiff
path: root/content/llcache.c
diff options
context:
space:
mode:
Diffstat (limited to 'content/llcache.c')
-rw-r--r--content/llcache.c15
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. */