Skip to content

Commit 847dfe8

Browse files
committed
Remove default ports if found in URLs.
1 parent 0e30cd9 commit 847dfe8

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

js/jsonld.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8111,6 +8111,13 @@ jsonld.url.parse = function(str, parser) {
81118111
while(i--) {
81128112
parsed[o.keys[i]] = (m[i] === undefined) ? null : m[i];
81138113
}
8114+
// remove default ports in found in URLs
8115+
if((parsed.scheme === 'https' && parsed.port === '443') ||
8116+
(parsed.scheme === 'http' && parsed.port === '80')) {
8117+
parsed.href = parsed.href.replace(':' + parsed.port, '');
8118+
parsed.authority = parsed.authority.replace(':' + parsed.port, '');
8119+
parsed.port = null;
8120+
}
81148121
parsed.normalizedPath = _removeDotSegments(parsed.path, !!parsed.authority);
81158122
return parsed;
81168123
};

0 commit comments

Comments
 (0)