www

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | Submodules | README | LICENSE

commit 93c6c6ab2a6ec59fcf4e0605f6c4702d30404379
parent aeb3cf546420454896cd50d6ad26689f5ca306cc
Author: Simon Kornblith <simon@simonster.com>
Date:   Wed, 17 Feb 2010 00:30:51 +0000

more proxy looping avoidance code


Diffstat:
Mchrome/content/zotero/xpcom/proxy.js | 10++++++++++
1 file changed, 10 insertions(+), 0 deletions(-)

diff --git a/chrome/content/zotero/xpcom/proxy.js b/chrome/content/zotero/xpcom/proxy.js @@ -151,6 +151,16 @@ Zotero.Proxies = new function() { } } + // make sure that the top two domains (e.g. gmu.edu in foo.bar.gmu.edu) of the + // channel and the site to which we're redirecting don't match, to prevent loops. + const top2DomainsRe = /[^\.]+\.[^\.]+$/; + top21 = top2DomainsRe.exec(channel.URI.host); + top22 = top2DomainsRe.exec(proxiedURI.host); + if(!top21 || !top22 || top21[0] == top22[0]) { + Zotero.debug("Zotero.Proxies: skipping redirect; redirect URI and URI have same top 2 domains"); + return; + } + // Otherwise, redirect. Note that we save the URI we're redirecting from as the // referrer, since we can't make a proper redirect webNav.loadURI(proxied, 0, channel.URI, null, null);