Skip to content

Commit

Permalink
New release 1.2.16
Browse files Browse the repository at this point in the history
  • Loading branch information
jcbrand committed Sep 16, 2018
1 parent a95625e commit 4eadadd
Show file tree
Hide file tree
Showing 7 changed files with 67 additions and 39 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Strophe.js Change Log

## Version 1.2.16 - (Unreleased)
## Version 1.2.16 - (2018-09-16)
* #299 'no-auth-mech' error. Server did not offer a supported authentication mechanism
* #306 Fix websocket close handler exception and reporting

Expand Down
1 change: 0 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ doc:
.PHONY: release
release:
$(SED) -i 's/\"version\":\ \"[0-9]\+\.[0-9]\+\.[0-9]\+\"/\"version\":\ \"$(VERSION)\"/' package.json
$(SED) -i 's/\"version\":\ \"[0-9]\+\.[0-9]\+\.[0-9]\+\"/\"version\":\ \"$(VERSION)\"/' package-lock.json
$(SED) -i "s/Unreleased/`date +%Y-%m-%d`/" CHANGELOG.md
make dist
make doc
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ covers Strophe in detail in the context of web applications.
## Quick Links

* [Homepage](http://strophe.im/strophejs)
* [Documentation](http://strophe.im/strophejs/doc/1.2.15/files/strophe-js.html)
* [Documentation](http://strophe.im/strophejs/doc/1.2.16/files/strophe-js.html)
* [Mailing list](http://groups.google.com/group/strophe)
* [Community Plugins](http://github.com/strophe/strophejs-plugins)

Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "strophe.js",
"description": "Strophe.js is an XMPP library for JavaScript",
"version": "1.2.15",
"version": "1.2.16",
"homepage": "http://strophe.im/strophejs",
"repository": {
"type": "git",
Expand Down
93 changes: 61 additions & 32 deletions strophe.js
Original file line number Diff line number Diff line change
Expand Up @@ -1289,7 +1289,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.
Expand Down Expand Up @@ -3839,26 +3839,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.
*
Expand Down Expand Up @@ -3921,7 +3901,7 @@ Strophe.Connection.prototype = {
bodyWrap.getElementsByTagName("features").length > 0;
}
if (!hasFeatures) {
this._no_auth_received(_callback);
this._proto._no_auth_received(_callback);
return;
}

Expand All @@ -3937,7 +3917,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;
}
}
Expand Down Expand Up @@ -5386,6 +5366,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.
*
Expand Down Expand Up @@ -6089,17 +6093,25 @@ Strophe.Websocket.prototype = {
this._connect_cb(streamStart);
}
} 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.xmlInput(message);
var see_uri = message.getAttribute("see-other-uri");
var see_uri = parsedMessage.getAttribute("see-other-uri");
if (see_uri) {
this._conn._changeConnectStatus(
Strophe.Status.REDIRECT,
"Received see-other-uri, resetting connection"
);
this._conn.reset();
this._conn.service = see_uri;
this._connect();
var service = this._conn.service;
// Valid scenarios: WSS->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,
Expand Down Expand Up @@ -6208,6 +6220,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.
*
Expand Down
4 changes: 2 additions & 2 deletions strophe.min.js

Large diffs are not rendered by default.

0 comments on commit 4eadadd

Please sign in to comment.