Skip to content

Commit b7e859f

Browse files
authored
Update cookiejar.py
1 parent 9d75634 commit b7e859f

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

Lib/http/cookiejar.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -659,11 +659,6 @@ def request_port(request):
659659
match = cut_port_re.search(request.host)
660660
if match:
661661
port = match[0].removeprefix(':')
662-
try:
663-
int(port)
664-
except ValueError:
665-
_debug("nonnumeric port: '%s'", port)
666-
return None
667662
else:
668663
port = DEFAULT_HTTP_PORT
669664
return port
@@ -1080,6 +1075,11 @@ def set_ok_port(self, cookie, request):
10801075
else:
10811076
req_port = str(req_port)
10821077
for p in cookie.port.split(","):
1078+
try:
1079+
int(p)
1080+
except ValueError:
1081+
_debug(" bad port %s (not numeric)", p)
1082+
return False
10831083
if p == req_port:
10841084
break
10851085
else:

0 commit comments

Comments
 (0)