[tor-commits] [torbutton/master] Bug 21627: Ignore HTTP 304 responses when checking redirects.

gk at torproject.org gk at torproject.org
Thu Jun 1 15:16:24 UTC 2017


commit ad937183266423425e166b417659b1db14aaeced
Author: Kathy Brade <brade at pearlcrescent.com>
Date:   Thu Jun 1 11:06:09 2017 -0400

    Bug 21627: Ignore HTTP 304 responses when checking redirects.
    
    Avoid noise on the error console when a page is reloaded. Since 304
    responses do not have Location headers, it is safe to ignore such
    responses inside our http-on-examine-response observer.
---
 src/components/content-policy.js | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/components/content-policy.js b/src/components/content-policy.js
index 365a5e5..a63919c 100644
--- a/src/components/content-policy.js
+++ b/src/components/content-policy.js
@@ -128,9 +128,9 @@ var requestObserver = {
 
     // If this is a redirect...
     //
-    // Note: Technically `304 Not Modifed` isn't a redirect, but receiving that
-    // to the proscribed schemes is nonsensical.
-    if (aStatus >= 300 && aStatus < 400) {
+    // Note: `304 Not Modifed` isn't a redirect, so there is no Location header to check
+    // in that case.
+    if (aStatus >= 300 && aStatus < 400 && aStatus != 304) {
       let location = aChannel.getResponseHeader("Location");
       let aUri = this.ioService.newURI(location, null, null);
 



More information about the tor-commits mailing list