mirror of
https://github.com/python/cpython.git
synced 2025-12-08 06:10:17 +00:00
bpo-30064: Refactor sock_* asyncio API (#10419)
This commit is contained in:
parent
9404e7737b
commit
7438792607
5 changed files with 170 additions and 449 deletions
|
|
@ -180,11 +180,21 @@ class SSLWSGIServer(SSLWSGIServerMixin, SilentWSGIServer):
|
|||
|
||||
def _run_test_server(*, address, use_ssl=False, server_cls, server_ssl_cls):
|
||||
|
||||
def loop(environ):
|
||||
size = int(environ['CONTENT_LENGTH'])
|
||||
while size:
|
||||
data = environ['wsgi.input'].read(min(size, 0x10000))
|
||||
yield data
|
||||
size -= len(data)
|
||||
|
||||
def app(environ, start_response):
|
||||
status = '200 OK'
|
||||
headers = [('Content-type', 'text/plain')]
|
||||
start_response(status, headers)
|
||||
return [b'Test message']
|
||||
if environ['PATH_INFO'] == '/loop':
|
||||
return loop(environ)
|
||||
else:
|
||||
return [b'Test message']
|
||||
|
||||
# Run the test WSGI server in a separate thread in order not to
|
||||
# interfere with event handling in the main thread
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue