[Pkg-javascript-commits] [sockjs-client] 125/350: Enable transport fall-through
tonnerre at ancient-solutions.com
tonnerre at ancient-solutions.com
Fri Aug 5 01:03:51 UTC 2016
This is an automated email from the git hooks/post-receive script.
tonnerre-guest pushed a commit to branch upstream
in repository sockjs-client.
commit dd043320b61872ec1247105c37d6878eb037fa77
Author: Bryce Kahle <bkahle at gmail.com>
Date: Mon Oct 13 11:19:34 2014 -0400
Enable transport fall-through
---
lib/main.js | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/lib/main.js b/lib/main.js
index 7544035..9d912f7 100644
--- a/lib/main.js
+++ b/lib/main.js
@@ -99,9 +99,13 @@ function SockJS(url, protocols, transportsWhitelist) {
util.inherits(SockJS, EventTarget);
+function userSetCode(code) {
+ return code && (code === 1000 || (code >= 3000 && code <= 4999));
+}
+
SockJS.prototype.close = function(code, reason) {
// Step 1
- if (code && code !== 1000 && (code < 3000 || code > 4999)) {
+ if (!userSetCode(code)) {
throw new InvalidAccessError('Invalid code');
}
// Step 2.4 states the max is 123 bytes, but we are just checking length
@@ -263,6 +267,11 @@ SockJS.prototype._close = function(code, reason, wasClean) {
throw new InvalidStateError('SockJS has already been closed');
}
+ if (!userSetCode(code) && code !== 2000 && this.readyState === SockJS.CONNECTING) {
+ this._connect();
+ return;
+ }
+
this.readyState = SockJS.CLOSING;
process.nextTick(function () {
this.readyState = SockJS.CLOSED;
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/sockjs-client.git
More information about the Pkg-javascript-commits
mailing list