Skip to content

Commit 72be24c

Browse files
committed
Remove default http and https ports.
1 parent 7f793d3 commit 72be24c

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

lib/pyld/jsonld.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -589,7 +589,12 @@ def parse_url(url):
589589
# regex from RFC 3986
590590
p = r'^(?:([^:/?#]+):)?(?://([^/?#]*))?([^?#]*)(?:\?([^#]*))?(?:#(.*))?'
591591
m = re.match(p, url)
592-
return ParsedUrl(*m.groups())
592+
# remove default http and https ports
593+
g = list(m.groups())
594+
if ((g[0] == 'https' and g[1].endswith(':443')) or
595+
(g[0] == 'http' and g[1].endswith(':80'))):
596+
g[1] = g[1][:g[1].rfind(':')]
597+
return ParsedUrl(*g)
593598

594599

595600
def unparse_url(parsed):

0 commit comments

Comments
 (0)