[Pkg-javascript-commits] [sockjs-client] 263/350: Upgrade url-parse to 0.1.0
tonnerre at ancient-solutions.com
tonnerre at ancient-solutions.com
Fri Aug 5 01:04:28 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 09cb0a9ff419402006bd65bbc6ae0b332b28c512
Author: Bryce Kahle <bkahle at gmail.com>
Date: Wed Nov 19 14:01:42 2014 -0500
Upgrade url-parse to 0.1.0
---
lib/main.js | 16 ++++------------
lib/transport/driver/xhr.js | 6 +++---
lib/utils/url.js | 4 ++--
package.json | 6 +++---
4 files changed, 12 insertions(+), 20 deletions(-)
diff --git a/lib/main.js b/lib/main.js
index 4bcf9e4..d90d874 100644
--- a/lib/main.js
+++ b/lib/main.js
@@ -2,7 +2,7 @@
require('./shims');
-var parse = require('url-parse')
+var URL = require('url-parse')
, inherits = require('inherits')
, JSON3 = require('json3')
, random = require('./utils/random')
@@ -49,8 +49,8 @@ function SockJS(url, protocols, options) {
this._server = options.server || random.numberString(1000);
// Step 1 of WS spec - parse and validate the url. Issue #8
- var parsedUrl = parse(url);
- if (!parsedUrl.host || !parsedUrl.pathname || !parsedUrl.protocol) {
+ var parsedUrl = new URL(url);
+ if (!parsedUrl.host || !parsedUrl.protocol) {
throw new SyntaxError("The URL '" + url + "' is invalid");
} else if (parsedUrl.hash) {
throw new SyntaxError('The URL must not contain a fragment');
@@ -87,16 +87,8 @@ function SockJS(url, protocols, options) {
var o = urlUtils.getOrigin(loc.href);
this._origin = o ? o.toLowerCase() : null;
- // strip port numbers for 80 and 443 cases
- // Issue #74
- if (!secure && parsedUrl.port === '80') {
- parsedUrl.host = parsedUrl.port = null;
- } else if (secure && parsedUrl.port === '443') {
- parsedUrl.host = parsedUrl.port = null;
- }
-
// remove the trailing slash
- parsedUrl.path = parsedUrl.pathname.replace(/[/]+$/, '') + (parsedUrl.search || '');
+ parsedUrl.path = parsedUrl.pathname.replace(/[/]+$/, '') + (parsedUrl.query || '');
// store the sanitized url
this.url = parsedUrl.protocol + '//' + parsedUrl.hostname + (parsedUrl.port ? (':' + parsedUrl.port) : '') + parsedUrl.path;
diff --git a/lib/transport/driver/xhr.js b/lib/transport/driver/xhr.js
index 2caf473..c6045b0 100644
--- a/lib/transport/driver/xhr.js
+++ b/lib/transport/driver/xhr.js
@@ -3,7 +3,7 @@
var EventEmitter = require('events').EventEmitter
, inherits = require('inherits')
, http = require('http')
- , parse = require('url-parse')
+ , URL = require('url-parse')
;
var debug = function() {};
@@ -16,12 +16,12 @@ function XhrDriver(method, url, payload, opts) {
var self = this;
EventEmitter.call(this);
- var parsedUrl = parse(url);
+ var parsedUrl = new URL(url);
var options = {
method: method
, hostname: parsedUrl.hostname
, port: parsedUrl.port
- , path: parsedUrl.path
+ , path: parsedUrl.pathname + (parsedUrl.query || '')
, headers: opts && opts.headers
, agent: false
};
diff --git a/lib/utils/url.js b/lib/utils/url.js
index 1634f04..2be2d41 100644
--- a/lib/utils/url.js
+++ b/lib/utils/url.js
@@ -1,6 +1,6 @@
'use strict';
-var parse = require('url-parse');
+var URL = require('url-parse');
var debug = function() {};
if (process.env.NODE_ENV !== 'production') {
@@ -13,7 +13,7 @@ module.exports = {
return null;
}
- var p = parse(url);
+ var p = new URL(url);
if (p.protocol === 'file:') {
return null;
}
diff --git a/package.json b/package.json
index f0381d9..b946f9a 100644
--- a/package.json
+++ b/package.json
@@ -1,7 +1,7 @@
{
"name": "sockjs-client",
"description": "SockJS-client is a browser JavaScript library that provides a WebSocket-like object. SockJS gives you a coherent, cross-browser, Javascript API which creates a low latency, full duplex, cross-domain communication channel between the browser and the web server.",
- "version": "1.0.0-beta.3",
+ "version": "1.0.0-beta.4",
"author": "Bryce Kahle",
"browser": {
"./lib/transport/driver/websocket.js": "./lib/transport/browser/websocket.js",
@@ -29,7 +29,7 @@
"faye-websocket": "~0.7.3",
"inherits": "^2.0.1",
"json3": "^3.3.2",
- "url-parse": "0.0.4"
+ "url-parse": "^0.1.0"
},
"devDependencies": {
"browserify": "^6.1.0",
@@ -45,7 +45,7 @@
"mocha": "^1.21.5",
"node-static": "^0.7.6",
"proxyquire": "~1.0.1",
- "sockjs": "^0.3.10",
+ "sockjs": "^0.3.11",
"vinyl-buffer": "~1.0.0",
"vinyl-source-stream": "^1.0.0",
"zuul": "git://github.com/brycekahle/zuul#ngrok"
--
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