File tree Expand file tree Collapse file tree 1 file changed +6
-4
lines changed
Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -254,7 +254,7 @@ client::
254254 # without passing it explicitly to this function.
255255
256256 client_addr = client_addr_var.get()
257- return f'Good bye, client @ {client_addr}\n'.encode()
257+ return f'Good bye, client @ {client_addr}\r\ n'.encode()
258258
259259 async def handle_request(reader, writer):
260260 addr = writer.transport.get_extra_info('socket').getpeername()
@@ -268,9 +268,10 @@ client::
268268 print(line)
269269 if not line.strip():
270270 break
271- writer.write(line)
272271
273- writer.write(render_goodbye())
272+ writer.write(b'HTTP/1.1 200 OK\r\n') # status line
273+ writer.write(b'\r\n') # headers
274+ writer.write(render_goodbye()) # body
274275 writer.close()
275276
276277 async def main():
@@ -282,5 +283,6 @@ client::
282283
283284 asyncio.run(main())
284285
285- # To test it you can use telnet:
286+ # To test it you can use telnet or curl :
286287 # telnet 127.0.0.1 8081
288+ # curl 127.0.0.1:8081
You can’t perform that action at this time.
0 commit comments