mirror of
https://git.steelants.cz/JonatanRek/VUE_GabenParadise.git
synced 2026-10-11 19:34:33 +00:00
Restruct
This commit is contained in:
1 parent
1ba0d7f9ba
commit
8d7722be91
3362 files changed
+13786
-500745
No files matched your search
+5
-9
@@ -1,7 +1,6 @@
|
||||
'use strict';
|
||||
|
||||
var Buffer = require('safe-buffer').Buffer,
|
||||
crypto = require('crypto'),
|
||||
var crypto = require('crypto'),
|
||||
url = require('url'),
|
||||
util = require('util'),
|
||||
HttpParser = require('../http_parser'),
|
||||
@@ -10,7 +9,7 @@ var Buffer = require('safe-buffer').Buffer,
|
||||
Proxy = require('./proxy');
|
||||
|
||||
var Client = function(_url, options) {
|
||||
this.version = 'hybi-' + Hybi.VERSION;
|
||||
this.version = 'hybi-13';
|
||||
Hybi.call(this, null, _url, options);
|
||||
|
||||
this.readyState = -1;
|
||||
@@ -19,7 +18,7 @@ var Client = function(_url, options) {
|
||||
this._http = new HttpParser('response');
|
||||
|
||||
var uri = url.parse(this.url),
|
||||
auth = uri.auth && Buffer.from(uri.auth, 'utf8').toString('base64');
|
||||
auth = uri.auth && new Buffer(uri.auth, 'utf8').toString('base64');
|
||||
|
||||
if (this.VALID_PROTOCOLS.indexOf(uri.protocol) < 0)
|
||||
throw new Error(this.url + ' is not a valid WebSocket URL');
|
||||
@@ -30,7 +29,7 @@ var Client = function(_url, options) {
|
||||
this._headers.set('Upgrade', 'websocket');
|
||||
this._headers.set('Connection', 'Upgrade');
|
||||
this._headers.set('Sec-WebSocket-Key', this._key);
|
||||
this._headers.set('Sec-WebSocket-Version', Hybi.VERSION);
|
||||
this._headers.set('Sec-WebSocket-Version', '13');
|
||||
|
||||
if (this._protocols.length > 0)
|
||||
this._headers.set('Sec-WebSocket-Protocol', this._protocols.join(', '));
|
||||
@@ -80,7 +79,7 @@ var instance = {
|
||||
var start = 'GET ' + this._pathname + ' HTTP/1.1',
|
||||
headers = [start, this._headers.toString(), ''];
|
||||
|
||||
return Buffer.from(headers.join('\r\n'), 'utf8');
|
||||
return new Buffer(headers.join('\r\n'), 'utf8');
|
||||
},
|
||||
|
||||
_failHandshake: function(message) {
|
||||
@@ -94,9 +93,6 @@ var instance = {
|
||||
this.statusCode = this._http.statusCode;
|
||||
this.headers = this._http.headers;
|
||||
|
||||
if (this._http.error)
|
||||
return this._failHandshake(this._http.error.message);
|
||||
|
||||
if (this._http.statusCode !== 101)
|
||||
return this._failHandshake('Unexpected response code: ' + this._http.statusCode);
|
||||
|
||||
|
||||
Reference in new issue
Block a user