[or-cvs] [https-everywhere/master] Attempting to re-fix the Wikipedia bug

pde at torproject.org pde at torproject.org
Fri Oct 29 22:05:17 UTC 2010


Author: Peter Eckersley <pde at eff.org>
Date: Fri, 29 Oct 2010 14:36:18 -0700
Subject: Attempting to re-fix the Wikipedia bug
Commit: 877c8fd580b36d1152d2fed8a3e1086055783fb8

This was svn commit r203 in the 0.2.2 branch, which went missing during the
transition to git :(.
---
 src/chrome/content/code/HTTPS.js   |   14 +++++++-------
 src/components/https-everywhere.js |   11 ++++++++---
 2 files changed, 15 insertions(+), 10 deletions(-)

diff --git a/src/chrome/content/code/HTTPS.js b/src/chrome/content/code/HTTPS.js
index 95d2f49..19e2ea3 100644
--- a/src/chrome/content/code/HTTPS.js
+++ b/src/chrome/content/code/HTTPS.js
@@ -37,6 +37,13 @@ const HTTPS = {
   },
   
   replaceChannel: function(channel) {
+    var uri = HTTPSRules.rewrittenURI(channel.URI);
+    if (!uri) {
+       HTTPS.log(INFO,
+           "Got replace channel with no applicable rules for URI "
+           + channel.URI.spec);
+       return;
+     }
 
     var c2=channel.QueryInterface(CI.nsIHttpChannel);
     this.log(DBUG,"Redirection limit is " + c2.redirectionLimit);
@@ -73,13 +80,6 @@ const HTTPS = {
            return;
          }
         } catch(e) {}
-        var uri = HTTPSRules.rewrittenURI(channel.URI);
-        if (!uri) {
-          HTTPS.log(INFO,
-              "Got replace channel with no applicable rules for URI "
-              + channel.URI.spec);
-          return;
-        }
         new ChannelReplacement(channel, uri).replace(true).open();
       });
       return true;
diff --git a/src/components/https-everywhere.js b/src/components/https-everywhere.js
index 597025a..c5163a0 100644
--- a/src/components/https-everywhere.js
+++ b/src/components/https-everywhere.js
@@ -254,7 +254,7 @@ HTTPSEverywhere.prototype = {
       return;
     }
 
-    HTTPS.forceChannel(newChannel);
+    HTTPS.replaceChannel(newChannel);
 
 //    if (HTTPS.forceURI(uri.clone())) {
 //      if (!HTTPS.replaceChannel(newChannel)) {
@@ -279,8 +279,13 @@ HTTPSEverywhere.prototype = {
   // to "should this load?", but also allow us to change the thing.
 
   shouldLoad: function(aContentType, aContentLocation, aRequestOrigin, aContext, aMimeTypeGuess, aInternalCall) {
-    if (aContentType == 11)
-      this.log(DBUG, "shouldLoad: "+aContentLocation.spec);
+    if (aContentType == 11) {
+      try {
+        this.log(DBUG, "shouldLoad: "+aContentLocation.spec);
+      } catch(e) {
+        this.log(DBUG,"shouldLoad exception");
+      }
+    }
     var unwrappedLocation = IOUtil.unwrapURL(aContentLocation);
     var scheme = unwrappedLocation.scheme;
     var isHTTP = /^https?$/.test(scheme);   // s? -> either http or https
-- 
1.7.1



More information about the tor-commits mailing list