Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

gh-131178: fix SSL tests forhttp.server command-line interface#134279

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
picnixz wants to merge15 commits intopython:main
base:main
Choose a base branch
Loading
frompicnixz:patch/httpserver-test-131178
Open
Changes from1 commit
Commits
Show all changes
15 commits
Select commitHold shift + click to select a range
038047a
fix `test_httpservers`
picnixzMay 19, 2025
444549b
add timeouts
picnixzMay 19, 2025
b189d06
only lookup a suitable address
picnixzMay 19, 2025
5c136f3
early abort
picnixzMay 19, 2025
bcef30f
docstring
picnixzMay 19, 2025
529b409
make the runtime test linux-specific
picnixzMay 19, 2025
ef659a2
Merge remote-tracking branch 'upstream/main' into patch/httpserver-te…
picnixzMay 19, 2025
71bb403
Merge remote-tracking branch 'upstream/main' into patch/httpserver-te…
picnixzMay 19, 2025
19e4972
take 2
picnixzMay 19, 2025
6a1e821
more debug info
picnixzMay 19, 2025
368d709
use 'localhost'
picnixzMay 19, 2025
a46c9c2
automatic deduction
picnixzMay 19, 2025
4ad442a
use 127.0.0.1 for HTTPS test
picnixzMay 19, 2025
f735ee5
reuse 127.0.0.1 everywhere???
picnixzMay 19, 2025
7686f3a
Merge branch 'main' into patch/httpserver-test-131178
picnixzMay 20, 2025
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
PrevPrevious commit
NextNext commit
automatic deduction
  • Loading branch information
@picnixz
picnixz committedMay 19, 2025
commita46c9c22691c667335a411647bce9fed5de7fb4c
13 changes: 5 additions & 8 deletionsLib/test/test_httpservers.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -1478,10 +1478,10 @@ def fetch_file(self, path, context=None):
return res.read()

def parse_cli_output(self, output):
matches = re.search(r'\((https?)://(\[::\]|[^/:]+):(\d+)/?\)', output)
matches = re.search(r'Serving (HTTP|HTTPS) on (.+) port(\d+)', output)
if matches is None:
return None, None, None
return matches.group(1), matches.group(2), int(matches.group(3))
return matches.group(1).lower(), matches.group(2), int(matches.group(3))

def wait_for_server(self, proc, protocol, port):
"""Extract the server bind address once it has been started."""
Expand All@@ -1496,8 +1496,7 @@ def wait_for_server(self, proc, protocol, port):

def test_http_client(self):
port = find_unused_port()
proc = spawn_python('-u', '-m', 'http.server',
str(port), '-b', 'localhost',
proc = spawn_python('-u', '-m', 'http.server', str(port),
bufsize=1, text=True)
self.addCleanup(kill_python, proc)
self.addCleanup(proc.terminate)
Expand All@@ -1514,9 +1513,8 @@ def test_https_client(self):
context.check_hostname = False
context.verify_mode = ssl.CERT_NONE

bind, port = 'localhost', find_unused_port()
proc = spawn_python('-u', '-m', 'http.server',
str(port), '-b', 'localhost',
port = find_unused_port()
proc = spawn_python('-u', '-m', 'http.server', str(port),
'--tls-cert', self.tls_cert,
'--tls-key', self.tls_key,
'--tls-password-file', self.tls_password_file,
Expand All@@ -1525,7 +1523,6 @@ def test_https_client(self):
self.addCleanup(proc.terminate)
bind = self.wait_for_server(proc, 'https', port)
self.assertIsNotNone(bind)
# localhost may be redirected to something else for whatever reason
url = f'https://{bind}:{port}/{self.served_filename}'
res = self.fetch_file(url, context=context)
self.assertEqual(res, self.served_data)
Expand Down
Loading

[8]ページ先頭

©2009-2025 Movatter.jp