diff options
Diffstat (limited to 'services/sync/modules/service.js')
-rw-r--r-- | services/sync/modules/service.js | 50 |
1 files changed, 27 insertions, 23 deletions
diff --git a/services/sync/modules/service.js b/services/sync/modules/service.js index 5c91323b5..32e047f53 100644 --- a/services/sync/modules/service.js +++ b/services/sync/modules/service.js @@ -1067,31 +1067,34 @@ Sync11Service.prototype = { // Note: returns false if we failed for a reason other than the server not yet // supporting the api. _fetchServerConfiguration() { - // This is similar to _fetchInfo, but with different error handling. + if (Svc.Prefs.get("APILevel") >= 2) { + // This is similar to _fetchInfo, but with different error handling. + // Only supported by later sync implementations. - let infoURL = this.userBaseURL + "info/configuration"; - this._log.debug("Fetching server configuration", infoURL); - let configResponse; - try { - configResponse = this.resource(infoURL).get(); - } catch (ex) { - // This is probably a network or similar error. - this._log.warn("Failed to fetch info/configuration", ex); - this.errorHandler.checkServerError(ex); - return false; - } + let infoURL = this.userBaseURL + "info/configuration"; + this._log.debug("Fetching server configuration", infoURL); + let configResponse; + try { + configResponse = this.resource(infoURL).get(); + } catch (ex) { + // This is probably a network or similar error. + this._log.warn("Failed to fetch info/configuration", ex); + this.errorHandler.checkServerError(ex); + return false; + } - if (configResponse.status == 404) { - // This server doesn't support the URL yet - that's OK. - this._log.debug("info/configuration returned 404 - using default upload semantics"); - } else if (configResponse.status != 200) { - this._log.warn(`info/configuration returned ${configResponse.status} - using default configuration`); - this.errorHandler.checkServerError(configResponse); - return false; - } else { - this.serverConfiguration = configResponse.obj; + if (configResponse.status == 404) { + // This server doesn't support the URL yet - that's OK. + this._log.debug("info/configuration returned 404 - using default upload semantics"); + } else if (configResponse.status != 200) { + this._log.warn(`info/configuration returned ${configResponse.status} - using default configuration`); + this.errorHandler.checkServerError(configResponse); + return false; + } else { + this.serverConfiguration = configResponse.obj; + } + this._log.trace("info/configuration for this server", this.serverConfiguration); } - this._log.trace("info/configuration for this server", this.serverConfiguration); return true; }, @@ -1335,9 +1338,10 @@ Sync11Service.prototype = { // We successfully synchronized. // Check if the identity wants to pre-fetch a migration sentinel from // the server. + // Only supported by Sync server API level 2+ // If we have no clusterURL, we are probably doing a node reassignment // so don't attempt to get it in that case. - if (this.clusterURL) { + if (Svc.Prefs.get("APILevel") >= 2 && this.clusterURL) { this.identity.prefetchMigrationSentinel(this); } |