Skip to content
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.

Fix for url.parse() leaving trailing ":" on the protocol/scheme #1580

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/url.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ exports.format = urlFormat;

// define these here so at least they only have to be
// compiled once on the first module load.
var protocolPattern = /^([a-z0-9]+:)/i,
var protocolPattern = /^([a-z0-9]+):/i,
portPattern = /:[0-9]+$/,
// RFC 2396: characters reserved for delimiting URLs.
delims = ['<', '>', '"', '`', ' ', '\r', '\n', '\t'],
Expand Down Expand Up @@ -99,7 +99,7 @@ function urlParse(url, parseQueryString, slashesDenoteHost) {

var proto = protocolPattern.exec(rest);
if (proto) {
proto = proto[0];
proto = proto[1];
var lowerProto = proto.toLowerCase();
out.protocol = lowerProto;
rest = rest.substr(proto.length);
Expand Down