commit 1ce795d46d18d0c7b50e921c287b3b7836652d2b
parent 171d072f313e3cc1a36301f61895d27372d27858
Author: Dan Stillman <dstillman@zotero.org>
Date: Tue, 22 Sep 2009 21:31:06 +0000
Restore previous WebDAV server verification behavior when parent directory isn't a WebDAV directory
Diffstat:
1 file changed, 14 insertions(+), 4 deletions(-)
diff --git a/chrome/content/zotero/xpcom/storage/webdav.js b/chrome/content/zotero/xpcom/storage/webdav.js
@@ -719,9 +719,7 @@ Zotero.Sync.Storage.Session.WebDAV.prototype.checkServer = function (callback) {
var self = this;
// Test whether URL is WebDAV-enabled
- var request = Zotero.Utilities.HTTP.doOptions(parentURI, function (req) {
- Zotero.debug(req.status);
-
+ var request = Zotero.Utilities.HTTP.doOptions(uri, function (req) {
// Timeout
if (req.status == 0) {
callback(uri, Zotero.Sync.Storage.ERROR_UNREACHABLE);
@@ -756,6 +754,10 @@ Zotero.Sync.Storage.Session.WebDAV.prototype.checkServer = function (callback) {
return;
}
+ // Get the Authorization header used in case we need to do a request
+ // on the parent below
+ var channelAuthorization = Zotero.Utilities.HTTP.getChannelAuthorization(req.channel);
+
var headers = { Depth: 0 };
// Test whether Zotero directory exists
@@ -840,6 +842,14 @@ Zotero.Sync.Storage.Session.WebDAV.prototype.checkServer = function (callback) {
return;
case 404:
+ // Include Authorization header from /zotero request,
+ // since Firefox probably won't apply it to the parent request
+ var newHeaders = {};
+ for (var header in headers) {
+ newHeaders[header] = headers[header];
+ }
+ newHeaders["Authorization"] = channelAuthorization;
+
// Zotero directory wasn't found, so see if at least
// the parent directory exists
Zotero.Utilities.HTTP.WebDAV.doProp("PROPFIND", parentURI, xmlstr,
@@ -870,7 +880,7 @@ Zotero.Sync.Storage.Session.WebDAV.prototype.checkServer = function (callback) {
callback(uri, Zotero.Sync.Storage.ERROR_UNKNOWN);
return;
}
- }, headers);
+ }, newHeaders);
return;
case 500: