https://github.com/python/cpython/commit/5be6c4e3c78f8f0ca1c7a5c8ab1465aeb150a7e9 commit: 5be6c4e3c78f8f0ca1c7a5c8ab1465aeb150a7e9 branch: 3.13 author: Miss Islington (bot) <[email protected]> committer: Yhg1s <[email protected]> date: 2024-09-24T11:17:51-07:00 summary:
[3.13] Mention `curl` in `contextvars` docs (GH-123838) (#123868) Mention `curl` in `contextvars` docs (GH-123838) (cherry picked from commit b950831c941a37c37b68a771610e072d11d33331) Co-authored-by: sobolevn <[email protected]> files: M Doc/library/contextvars.rst diff --git a/Doc/library/contextvars.rst b/Doc/library/contextvars.rst index b2261ea5127e61..2a79dfe8f81e26 100644 --- a/Doc/library/contextvars.rst +++ b/Doc/library/contextvars.rst @@ -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 _______________________________________________ Python-checkins mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3/lists/python-checkins.python.org/ Member address: [email protected]
