Show redirect URL in the sync stream listener (for file downloads)
Also consolidate the display-URL-password-hiding logic in http.js
This commit is contained in:
parent
79cd7197ff
commit
62e779beec
2 changed files with 21 additions and 37 deletions
|
@ -68,12 +68,8 @@ Zotero.HTTP = new function() {
|
|||
this.promise = function promise(method, url, options) {
|
||||
if (url instanceof Components.interfaces.nsIURI) {
|
||||
// Don't display password in console
|
||||
var dispURL = url.clone();
|
||||
if (dispURL.password) {
|
||||
dispURL.password = "********";
|
||||
}
|
||||
var dispURL = this.getDisplayURI(url).spec;
|
||||
url = url.spec;
|
||||
dispURL = dispURL.spec;
|
||||
}
|
||||
else {
|
||||
var dispURL = url;
|
||||
|
@ -212,10 +208,7 @@ Zotero.HTTP = new function() {
|
|||
this.doGet = function(url, onDone, responseCharset, cookieSandbox) {
|
||||
if (url instanceof Components.interfaces.nsIURI) {
|
||||
// Don't display password in console
|
||||
var disp = url.clone();
|
||||
if (disp.password) {
|
||||
disp.password = "********";
|
||||
}
|
||||
var disp = this.getDisplayURI(url);
|
||||
Zotero.debug("HTTP GET " + disp.spec);
|
||||
url = url.spec;
|
||||
}
|
||||
|
@ -276,10 +269,7 @@ Zotero.HTTP = new function() {
|
|||
this.doPost = function(url, body, onDone, headers, responseCharset, cookieSandbox) {
|
||||
if (url instanceof Components.interfaces.nsIURI) {
|
||||
// Don't display password in console
|
||||
var disp = url.clone();
|
||||
if (disp.password) {
|
||||
disp.password = "********";
|
||||
}
|
||||
var disp = this.getDisplayURI(url);
|
||||
url = url.spec;
|
||||
}
|
||||
|
||||
|
@ -363,10 +353,7 @@ Zotero.HTTP = new function() {
|
|||
this.doHead = function(url, onDone, requestHeaders, cookieSandbox) {
|
||||
if (url instanceof Components.interfaces.nsIURI) {
|
||||
// Don't display password in console
|
||||
var disp = url.clone();
|
||||
if (disp.password) {
|
||||
disp.password = "********";
|
||||
}
|
||||
var disp = this.getDisplayURI(url);
|
||||
Zotero.debug("HTTP HEAD " + disp.spec);
|
||||
url = url.spec;
|
||||
}
|
||||
|
@ -424,10 +411,7 @@ Zotero.HTTP = new function() {
|
|||
*/
|
||||
this.doOptions = function (uri, callback) {
|
||||
// Don't display password in console
|
||||
var disp = uri.clone();
|
||||
if (disp.password) {
|
||||
disp.password = "********";
|
||||
}
|
||||
var disp = this.getDisplayURI(uri);
|
||||
Zotero.debug("HTTP OPTIONS for " + disp.spec);
|
||||
|
||||
if (Zotero.HTTP.browserIsOffline()){
|
||||
|
@ -619,10 +603,7 @@ Zotero.HTTP = new function() {
|
|||
}
|
||||
|
||||
// Don't display password in console
|
||||
var disp = uri.clone();
|
||||
if (disp.password) {
|
||||
disp.password = "********";
|
||||
}
|
||||
var disp = this.getDisplayURI(uri);
|
||||
|
||||
var bodyStart = body.substr(0, 1024);
|
||||
Zotero.debug("HTTP " + method + " "
|
||||
|
@ -672,10 +653,7 @@ Zotero.HTTP = new function() {
|
|||
*/
|
||||
this.WebDAV.doMkCol = function (uri, callback) {
|
||||
// Don't display password in console
|
||||
var disp = uri.clone();
|
||||
if (disp.password) {
|
||||
disp.password = "********";
|
||||
}
|
||||
var disp = this.getDisplayURI(uri);
|
||||
Zotero.debug("HTTP MKCOL " + disp.spec);
|
||||
|
||||
if (Zotero.HTTP.browserIsOffline()) {
|
||||
|
@ -709,10 +687,7 @@ Zotero.HTTP = new function() {
|
|||
*/
|
||||
this.WebDAV.doPut = function (uri, body, callback) {
|
||||
// Don't display password in console
|
||||
var disp = uri.clone();
|
||||
if (disp.password) {
|
||||
disp.password = "********";
|
||||
}
|
||||
var disp = this.getDisplayURI(uri);
|
||||
|
||||
var bodyStart = "'" + body.substr(0, 1024) + "'";
|
||||
Zotero.debug("HTTP PUT "
|
||||
|
@ -754,10 +729,7 @@ Zotero.HTTP = new function() {
|
|||
*/
|
||||
this.WebDAV.doDelete = function (uri, callback) {
|
||||
// Don't display password in console
|
||||
var disp = uri.clone();
|
||||
if (disp.password) {
|
||||
disp.password = "********";
|
||||
}
|
||||
var disp = this.getDisplayURI(uri);
|
||||
|
||||
Zotero.debug("WebDAV DELETE to " + disp.spec);
|
||||
|
||||
|
@ -785,6 +757,15 @@ Zotero.HTTP = new function() {
|
|||
}
|
||||
|
||||
|
||||
this.getDisplayURI = function (uri) {
|
||||
var disp = uri.clone();
|
||||
if (disp.password) {
|
||||
disp.password = "********";
|
||||
}
|
||||
return disp;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the Authorization header used by a channel
|
||||
*
|
||||
|
|
|
@ -141,6 +141,9 @@ Zotero.Sync.Storage.StreamListener.prototype = {
|
|||
// nsIHttpEventSink
|
||||
onRedirect: function (oldChannel, newChannel) {
|
||||
Zotero.debug('onRedirect');
|
||||
|
||||
var newURL = Zotero.HTTP.getDisplayURI(newChannel.URI).spec;
|
||||
Zotero.debug("Redirecting to " + newURL);
|
||||
},
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue