Skip to content

Commit fa5ac67

Browse files
committed
examples/network/http_client*: Use \r\n line-endings in request.
1 parent 3dabaae commit fa5ac67

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

examples/network/http_client.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@ def main(use_stream=False):
1818
# MicroPython socket objects support stream (aka file) interface
1919
# directly, but the line below is needed for CPython.
2020
s = s.makefile("rwb", 0)
21-
s.write(b"GET / HTTP/1.0\n\n")
21+
s.write(b"GET / HTTP/1.0\r\n\r\n")
2222
print(s.readall())
2323
else:
24-
s.send(b"GET / HTTP/1.0\n\n")
24+
s.send(b"GET / HTTP/1.0\r\n\r\n")
2525
print(s.recv(4096))
2626

2727
s.close()

examples/network/http_client_ssl.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,12 @@ def main(use_stream=True):
2424
if use_stream:
2525
# Both CPython and MicroPython SSLSocket objects support read() and
2626
# write() methods.
27-
s.write(b"GET / HTTP/1.0\n\n")
27+
s.write(b"GET / HTTP/1.0\r\n\r\n")
2828
print(s.read(4096))
2929
else:
3030
# MicroPython SSLSocket objects implement only stream interface, not
3131
# socket interface
32-
s.send(b"GET / HTTP/1.0\n\n")
32+
s.send(b"GET / HTTP/1.0\r\n\r\n")
3333
print(s.recv(4096))
3434

3535
s.close()

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy