mirror of
https://github.com/python/cpython.git
synced 2025-10-09 16:34:44 +00:00
[3.12] Mention curl
in contextvars
docs (GH-123838) (#123869)
Mention `curl` in `contextvars` docs (GH-123838)
(cherry picked from commit b950831c94
)
Co-authored-by: sobolevn <mail@sobolevn.me>
This commit is contained in:
parent
8b16ec65a2
commit
9e38723a15
1 changed files with 6 additions and 4 deletions
|
@ -254,7 +254,7 @@ client::
|
|||
# without passing it explicitly to this function.
|
||||
|
||||
client_addr = client_addr_var.get()
|
||||
return f'Good bye, client @ {client_addr}\n'.encode()
|
||||
return f'Good bye, client @ {client_addr}\r\n'.encode()
|
||||
|
||||
async def handle_request(reader, writer):
|
||||
addr = writer.transport.get_extra_info('socket').getpeername()
|
||||
|
@ -268,9 +268,10 @@ client::
|
|||
print(line)
|
||||
if not line.strip():
|
||||
break
|
||||
writer.write(line)
|
||||
|
||||
writer.write(render_goodbye())
|
||||
writer.write(b'HTTP/1.1 200 OK\r\n') # status line
|
||||
writer.write(b'\r\n') # headers
|
||||
writer.write(render_goodbye()) # body
|
||||
writer.close()
|
||||
|
||||
async def main():
|
||||
|
@ -282,5 +283,6 @@ client::
|
|||
|
||||
asyncio.run(main())
|
||||
|
||||
# To test it you can use telnet:
|
||||
# To test it you can use telnet or curl:
|
||||
# telnet 127.0.0.1 8081
|
||||
# curl 127.0.0.1:8081
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue