[Pkg-javascript-commits] [sockjs-client] 299/350: Simplify the URL sanitization

tonnerre at ancient-solutions.com tonnerre at ancient-solutions.com
Fri Aug 5 01:04:32 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 cd626d33bc33320d8309cc3da500cda151114c53
Author: Luigi Pinca <luigipinca at gmail.com>
Date:   Wed May 6 12:56:57 2015 +0200

    Simplify the URL sanitization
---
 lib/main.js | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/lib/main.js b/lib/main.js
index 9b6c90a..cf30947 100644
--- a/lib/main.js
+++ b/lib/main.js
@@ -92,11 +92,10 @@ function SockJS(url, protocols, options) {
   this._origin = o ? o.toLowerCase() : null;
 
   // remove the trailing slash
-  parsedUrl.path = parsedUrl.pathname.replace(/[/]+$/, '') + (parsedUrl.query || '');
+  parsedUrl.set('pathname', parsedUrl.pathname.replace(/\/+$/, ''));
 
   // store the sanitized url
-  this.url = parsedUrl.protocol + '//' + (parsedUrl.auth ? parsedUrl.auth + '@' : '') +
-    parsedUrl.hostname + (parsedUrl.port ? ':' + parsedUrl.port : '') + parsedUrl.path;
+  this.url = parsedUrl.href;
   debug('using url', this.url);
 
   // Step 7 - start connection in background

-- 
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