Commit 60b08d41 authored by JC Brand's avatar JC Brand

Fixes #1203

Update to Strophe 1.2.16
parent ad9a840c
...@@ -48012,7 +48012,7 @@ function $pres(attrs) { return new Strophe.Builder("presence", attrs); } ...@@ -48012,7 +48012,7 @@ function $pres(attrs) { return new Strophe.Builder("presence", attrs); }
*/ */
Strophe = { Strophe = {
/** Constant: VERSION */ /** Constant: VERSION */
VERSION: "1.2.15", VERSION: "1.2.16",
/** Constants: XMPP Namespace Constants /** Constants: XMPP Namespace Constants
* Common namespace constants from the XMPP RFCs and XEPs. * Common namespace constants from the XMPP RFCs and XEPs.
...@@ -50562,26 +50562,6 @@ Strophe.Connection.prototype = { ...@@ -50562,26 +50562,6 @@ Strophe.Connection.prototype = {
*/ */
mechanisms: {}, 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 /** PrivateFunction: _connect_cb
* _Private_ handler for initial connection request. * _Private_ handler for initial connection request.
* *
...@@ -50644,7 +50624,7 @@ Strophe.Connection.prototype = { ...@@ -50644,7 +50624,7 @@ Strophe.Connection.prototype = {
bodyWrap.getElementsByTagName("features").length > 0; bodyWrap.getElementsByTagName("features").length > 0;
} }
if (!hasFeatures) { if (!hasFeatures) {
this._no_auth_received(_callback); this._proto._no_auth_received(_callback);
return; return;
} }
...@@ -50660,7 +50640,7 @@ Strophe.Connection.prototype = { ...@@ -50660,7 +50640,7 @@ Strophe.Connection.prototype = {
if (bodyWrap.getElementsByTagName("auth").length === 0) { if (bodyWrap.getElementsByTagName("auth").length === 0) {
// There are no matching SASL mechanisms and also no legacy // There are no matching SASL mechanisms and also no legacy
// auth available. // auth available.
this._no_auth_received(_callback); this._proto._no_auth_received(_callback);
return; return;
} }
} }
...@@ -52106,6 +52086,30 @@ Strophe.Bosh.prototype = { ...@@ -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 /** PrivateFunction: _onDisconnectTimeout
* _Private_ timeout handler for handling non-graceful disconnection. * _Private_ timeout handler for handling non-graceful disconnection.
* *
...@@ -52806,17 +52810,25 @@ Strophe.Websocket.prototype = { ...@@ -52806,17 +52810,25 @@ Strophe.Websocket.prototype = {
this._connect_cb(streamStart); this._connect_cb(streamStart);
} }
} else if (message.data.indexOf("<close ") === 0) { // <close xmlns="urn:ietf:params:xml:ns:xmpp-framing /> } else if (message.data.indexOf("<close ") === 0) { // <close xmlns="urn:ietf:params:xml:ns:xmpp-framing />
// Parse the raw string to an XML element
var parsedMessage = new DOMParser().parseFromString(message.data, "text/xml").documentElement;
// Report this input to the raw and xml handlers
this._conn.xmlInput(parsedMessage);
this._conn.rawInput(message.data); this._conn.rawInput(message.data);
this._conn.xmlInput(message); var see_uri = parsedMessage.getAttribute("see-other-uri");
var see_uri = message.getAttribute("see-other-uri");
if (see_uri) { if (see_uri) {
this._conn._changeConnectStatus( var service = this._conn.service;
Strophe.Status.REDIRECT, // Valid scenarios: WSS->WSS, WS->ANY
"Received see-other-uri, resetting connection" var isSecureRedirect = (service.indexOf("wss:") >= 0 && see_uri.indexOf("wss:") >= 0) || (service.indexOf("ws:") >= 0);
); if(isSecureRedirect) {
this._conn.reset(); this._conn._changeConnectStatus(
this._conn.service = see_uri; Strophe.Status.REDIRECT,
this._connect(); "Received see-other-uri, resetting connection"
);
this._conn.reset();
this._conn.service = see_uri;
this._connect();
}
} else { } else {
this._conn._changeConnectStatus( this._conn._changeConnectStatus(
Strophe.Status.CONNFAIL, Strophe.Status.CONNFAIL,
...@@ -52925,6 +52937,23 @@ Strophe.Websocket.prototype = { ...@@ -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 /** PrivateFunction: _onDisconnectTimeout
* _Private_ timeout handler for handling non-graceful disconnection. * _Private_ timeout handler for handling non-graceful disconnection.
* *
...@@ -14078,9 +14078,9 @@ ...@@ -14078,9 +14078,9 @@
"dev": true "dev": true
}, },
"strophe.js": { "strophe.js": {
"version": "1.2.15", "version": "1.2.16",
"resolved": "https://registry.npmjs.org/strophe.js/-/strophe.js-1.2.15.tgz", "resolved": "https://registry.npmjs.org/strophe.js/-/strophe.js-1.2.16.tgz",
"integrity": "sha512-aM5SCLltSLKubPNil28ieJ03I+15jcVX02c1/7SBVIUWRfwfxwondRJSMJpB7OBss5b3jCNxpTqig8nXncJ5yg==", "integrity": "sha512-r/Uq7aqrusg25Y0qHwV48cFnMY6K/CuZdGt3EggRx3kY4sMv8lG+AFoMlrmTcYVMG1BaJvQfv9Cthw4Ll8z7fQ==",
"dev": true "dev": true
}, },
"strophejs-plugin-ping": { "strophejs-plugin-ping": {
...@@ -14089,7 +14089,7 @@ ...@@ -14089,7 +14089,7 @@
"integrity": "sha1-NXEmxTZZSwZmjhh4c4Ey+sNciJY=", "integrity": "sha1-NXEmxTZZSwZmjhh4c4Ey+sNciJY=",
"dev": true, "dev": true,
"requires": { "requires": {
"strophe.js": "1.2.15" "strophe.js": "1.2.16"
} }
}, },
"strophejs-plugin-register": { "strophejs-plugin-register": {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment