Skip to content

Commit 48064f2

Browse files
authored
Update cookiejar.py
1 parent f129053 commit 48064f2

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

Lib/http/cookiejar.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -656,10 +656,9 @@ def request_path(request):
656656
return path
657657

658658
def request_port(request):
659-
host = request.host
660-
i = host.find(':')
661-
if i >= 0:
662-
port = host[i+1:]
659+
match = cut_port_re.search(request.host)
660+
if match:
661+
port = match.group(0).removeprefix(':')
663662
try:
664663
int(port)
665664
except ValueError:

0 commit comments

Comments
 (0)