Bug 806494 - Part 1: additional logging and safety for header copying. r=gps
authorRichard Newman <rnewman@mozilla.com>
Tue, 18 Dec 2012 11:42:22 -0800
changeset 125524 4b7e8f82a341878531c1ca12195bf2ac2f9960de
parent 125523 d3d48381d3240a52ce2092ca17c2cb00f74d26df
child 125525 95566cb18e2e13f0ed5a4a7dfd6270c273f0da91
push id2151
push userlsblakk@mozilla.com
push dateTue, 19 Feb 2013 18:06:57 +0000
treeherdermozilla-beta@4952e88741ec [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgps
bugs806494
milestone20.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 806494 - Part 1: additional logging and safety for header copying. r=gps
services/sync/modules/resource.js
--- a/services/sync/modules/resource.js
+++ b/services/sync/modules/resource.js
@@ -608,25 +608,32 @@ ChannelNotificationListener.prototype = 
 
   asyncOnChannelRedirect:
     function asyncOnChannelRedirect(oldChannel, newChannel, flags, callback) {
 
     let oldSpec = (oldChannel && oldChannel.URI) ? oldChannel.URI.spec : "<undefined>";
     let newSpec = (newChannel && newChannel.URI) ? newChannel.URI.spec : "<undefined>";
     this._log.debug("Channel redirect: " + oldSpec + ", " + newSpec + ", " + flags);
 
+    this._log.debug("Ensuring load flags are set.");
+    newChannel.loadFlags |= DEFAULT_LOAD_FLAGS;
+
     // For internal redirects, copy the headers that our caller set.
     try {
       if ((flags & Ci.nsIChannelEventSink.REDIRECT_INTERNAL) &&
           newChannel.URI.equals(oldChannel.URI)) {
-        this._log.trace("Copying headers for safe internal redirect.");
+        this._log.debug("Copying headers for safe internal redirect.");
         for (let header of this._headersToCopy) {
           let value = oldChannel.getRequestHeader(header);
           if (value) {
+            let printed = (header == "authorization") ? "****" : value;
+            this._log.debug("Header: " + header + " = " + printed);
             newChannel.setRequestHeader(header, value);
+          } else {
+            this._log.warn("No value for header " + header);
           }
         }
       }
     } catch (ex) {
       this._log.error("Error copying headers: " + CommonUtils.exceptionStr(ex));
     }
 
     // We let all redirects proceed.