commit 1e2dc0035fd68d07215e52eeb238f8b2a0977d37
parent aed441e152132a5d42dc9fad89bdb16f5480267b
Author: Dan Stillman <dstillman@zotero.org>
Date: Tue, 28 Sep 2010 23:44:16 +0000
Replace HEAD requests in ZFS syncing with GET requests to work around compatibility problems with proxy servers and security software
Diffstat:
1 file changed, 19 insertions(+), 4 deletions(-)
diff --git a/chrome/content/zotero/xpcom/storage/zfs.js b/chrome/content/zotero/xpcom/storage/zfs.js
@@ -107,11 +107,11 @@ Zotero.Sync.Storage.Session.ZFS.prototype.initFromPrefs = function () {
* @param {Function} callback Callback f(item, etag)
*/
Zotero.Sync.Storage.Session.ZFS.prototype._getStorageFileInfo = function (item, callback) {
- var uri = this._getItemURI(item);
+ var uri = this._getItemInfoURI(item);
var self = this;
- Zotero.Utilities.HTTP.doHead(uri, function (req) {
+ Zotero.Utilities.HTTP.doGet(uri, function (req) {
var funcName = "Zotero.Sync.Storage.Session.ZFS._getStorageFileInfo()";
if (req.status == 404) {
@@ -131,7 +131,7 @@ Zotero.Sync.Storage.Session.ZFS.prototype._getStorageFileInfo = function (item,
var info = {};
info.hash = req.getResponseHeader('ETag');
if (!info.hash) {
- var msg = "Hash not found in HEAD response in " + funcName
+ var msg = "Hash not found in info response in " + funcName
+ " (" + Zotero.Items.getLibraryKeyHash(item) + ")";
Zotero.debug(msg, 1);
Zotero.debug(req.responseText);
@@ -832,7 +832,7 @@ Zotero.Sync.Storage.Session.ZFS.prototype.getLastSyncTime = function (callback)
var uri = this.rootURI;
// TODO: move to root uri
uri.spec += "?auth=1";
- Zotero.Utilities.HTTP.doHead(uri, function (req) {
+ Zotero.Utilities.HTTP.doGet(uri, function (req) {
if (req.status != 200) {
var msg = "Unexpected status code " + req.status + " caching "
+ "authentication credentials in Zotero.Sync.Storage.Session.ZFS.getLastSyncTime()";
@@ -1002,11 +1002,26 @@ Zotero.Sync.Storage.Session.ZFS.prototype.purgeDeletedStorageFiles = function (c
*/
Zotero.Sync.Storage.Session.ZFS.prototype._getItemURI = function (item) {
var uri = this.rootURI;
+ // Be sure to mirror parameter changes to _getItemInfoURI below
uri.spec += Zotero.URI.getItemPath(item) + '/file?auth=1&iskey=1&version=1';
return uri;
}
+/**
+ * Get the storage info URI for an item
+ *
+ * @inner
+ * @param {Zotero.Item}
+ * @return {nsIURI} URI of file on storage server with info flag
+ */
+Zotero.Sync.Storage.Session.ZFS.prototype._getItemInfoURI = function (item) {
+ var uri = this.rootURI;
+ uri.spec += Zotero.URI.getItemPath(item) + '/file?auth=1&iskey=1&version=1&info=1';
+ return uri;
+}
+
+
Zotero.Sync.Storage.Session.ZFS.prototype._getUploadFile = function (item) {
if (Zotero.Attachments.getNumFiles(item) > 1) {
var file = Zotero.getTempDirectory();