Skip to content

Commit

Permalink
Merge pull request #242 from lpinca/simplify/url-sanitization
Browse files Browse the repository at this point in the history
Simplify the URL sanitization
  • Loading branch information
brycekahle committed May 6, 2015
2 parents fdf37da + cd626d3 commit 9bcb964
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions lib/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 9bcb964

Please sign in to comment.