Bug 806494 - Part 1: additional logging and safety for header copying. r=gps
authorRichard Newman <rnewman@mozilla.com>
Tue, 18 Dec 2012 11:43:58 -0800
changeset 117361 5c5e1e93e3a91b5a0a1b2f2fd0ef8346ea64a6a3
parent 117360 2aff055f9d1829077423c7c67b85d2d43b7cb442
child 117362 8468249f439a465788a8a8c789b543704e540d36
push id24098
push userrnewman@mozilla.com
push dateThu, 03 Jan 2013 03:39:06 +0000
treeherdermozilla-central@6955309291ee [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.