diff --git a/dist/converse.js b/dist/converse.js index 5b03036fb..6dc3ad580 100644 --- a/dist/converse.js +++ b/dist/converse.js @@ -48012,7 +48012,7 @@ function $pres(attrs) { return new Strophe.Builder("presence", attrs); } */ Strophe = { /** Constant: VERSION */ - VERSION: "1.2.15", + VERSION: "1.2.16", /** Constants: XMPP Namespace Constants * Common namespace constants from the XMPP RFCs and XEPs. @@ -50562,26 +50562,6 @@ Strophe.Connection.prototype = { */ mechanisms: {}, - /** PrivateFunction: _no_auth_received - * - * Called on stream start/restart when no stream:features - * has been received or when no viable authentication mechanism is offered. - * - * Sends a blank poll request. - */ - _no_auth_received: function (_callback) { - var error_msg = "Server did not offer a supported authentication mechanism"; - Strophe.error(error_msg); - this._changeConnectStatus( - Strophe.Status.CONNFAIL, - Strophe.ErrorCondition.NO_AUTH_MECH - ); - if (_callback) { - _callback.call(this); - } - this._doDisconnect(); - }, - /** PrivateFunction: _connect_cb * _Private_ handler for initial connection request. * @@ -50644,7 +50624,7 @@ Strophe.Connection.prototype = { bodyWrap.getElementsByTagName("features").length > 0; } if (!hasFeatures) { - this._no_auth_received(_callback); + this._proto._no_auth_received(_callback); return; } @@ -50660,7 +50640,7 @@ Strophe.Connection.prototype = { if (bodyWrap.getElementsByTagName("auth").length === 0) { // There are no matching SASL mechanisms and also no legacy // auth available. - this._no_auth_received(_callback); + this._proto._no_auth_received(_callback); return; } } @@ -52106,6 +52086,30 @@ Strophe.Bosh.prototype = { } }, + /** PrivateFunction: _no_auth_received + * + * Called on stream start/restart when no stream:features + * has been received and sends a blank poll request. + */ + _no_auth_received: function (callback) { + Strophe.warn("Server did not yet offer a supported authentication "+ + "mechanism. Sending a blank poll request."); + if (callback) { + callback = callback.bind(this._conn); + } else { + callback = this._conn._connect_cb.bind(this._conn); + } + var body = this._buildBody(); + this._requests.push( + new Strophe.Request( + body.tree(), + this._onRequestStateChange.bind(this, callback), + body.tree().getAttribute("rid") + ) + ); + this._throttledRequestHandler(); + }, + /** PrivateFunction: _onDisconnectTimeout * _Private_ timeout handler for handling non-graceful disconnection. * @@ -52806,17 +52810,25 @@ Strophe.Websocket.prototype = { this._connect_cb(streamStart); } } else if (message.data.indexOf("WSS, WS->ANY + var isSecureRedirect = (service.indexOf("wss:") >= 0 && see_uri.indexOf("wss:") >= 0) || (service.indexOf("ws:") >= 0); + if(isSecureRedirect) { + this._conn._changeConnectStatus( + Strophe.Status.REDIRECT, + "Received see-other-uri, resetting connection" + ); + this._conn.reset(); + this._conn.service = see_uri; + this._connect(); + } } else { this._conn._changeConnectStatus( Strophe.Status.CONNFAIL, @@ -52925,6 +52937,23 @@ Strophe.Websocket.prototype = { } }, + /** PrivateFunction: _no_auth_received + * + * Called on stream start/restart when no stream:features + * has been received. + */ + _no_auth_received: function (callback) { + Strophe.error("Server did not offer a supported authentication mechanism"); + this._changeConnectStatus( + Strophe.Status.CONNFAIL, + Strophe.ErrorCondition.NO_AUTH_MECH + ); + if (callback) { + callback.call(this._conn); + } + this._conn._doDisconnect(); + }, + /** PrivateFunction: _onDisconnectTimeout * _Private_ timeout handler for handling non-graceful disconnection. * diff --git a/package-lock.json b/package-lock.json index 8e98079b8..d6e19fb70 100644 --- a/package-lock.json +++ b/package-lock.json @@ -14078,9 +14078,9 @@ "dev": true }, "strophe.js": { - "version": "1.2.15", - "resolved": "https://registry.npmjs.org/strophe.js/-/strophe.js-1.2.15.tgz", - "integrity": "sha512-aM5SCLltSLKubPNil28ieJ03I+15jcVX02c1/7SBVIUWRfwfxwondRJSMJpB7OBss5b3jCNxpTqig8nXncJ5yg==", + "version": "1.2.16", + "resolved": "https://registry.npmjs.org/strophe.js/-/strophe.js-1.2.16.tgz", + "integrity": "sha512-r/Uq7aqrusg25Y0qHwV48cFnMY6K/CuZdGt3EggRx3kY4sMv8lG+AFoMlrmTcYVMG1BaJvQfv9Cthw4Ll8z7fQ==", "dev": true }, "strophejs-plugin-ping": { @@ -14089,7 +14089,7 @@ "integrity": "sha1-NXEmxTZZSwZmjhh4c4Ey+sNciJY=", "dev": true, "requires": { - "strophe.js": "1.2.15" + "strophe.js": "1.2.16" } }, "strophejs-plugin-register": { diff --git a/package.json b/package.json index bff1438ff..2535fdfa0 100644 --- a/package.json +++ b/package.json @@ -78,7 +78,7 @@ "sinon": "^2.1.0", "sizzle": "^2.3.3", "snabbdom": "0.7.1", - "strophe.js": "1.2.15", + "strophe.js": "1.2.16", "strophejs-plugin-ping": "0.0.1", "strophejs-plugin-register": "0.0.1", "strophejs-plugin-rsm": "0.0.1",