Commit fa5ac678 authored by Paul Sokolovsky's avatar Paul Sokolovsky

examples/network/http_client*: Use \r\n line-endings in request.

parent 3dabaae4
...@@ -18,10 +18,10 @@ def main(use_stream=False): ...@@ -18,10 +18,10 @@ def main(use_stream=False):
# MicroPython socket objects support stream (aka file) interface # MicroPython socket objects support stream (aka file) interface
# directly, but the line below is needed for CPython. # directly, but the line below is needed for CPython.
s = s.makefile("rwb", 0) s = s.makefile("rwb", 0)
s.write(b"GET / HTTP/1.0\n\n") s.write(b"GET / HTTP/1.0\r\n\r\n")
print(s.readall()) print(s.readall())
else: else:
s.send(b"GET / HTTP/1.0\n\n") s.send(b"GET / HTTP/1.0\r\n\r\n")
print(s.recv(4096)) print(s.recv(4096))
s.close() s.close()
......
...@@ -24,12 +24,12 @@ def main(use_stream=True): ...@@ -24,12 +24,12 @@ def main(use_stream=True):
if use_stream: if use_stream:
# Both CPython and MicroPython SSLSocket objects support read() and # Both CPython and MicroPython SSLSocket objects support read() and
# write() methods. # write() methods.
s.write(b"GET / HTTP/1.0\n\n") s.write(b"GET / HTTP/1.0\r\n\r\n")
print(s.read(4096)) print(s.read(4096))
else: else:
# MicroPython SSLSocket objects implement only stream interface, not # MicroPython SSLSocket objects implement only stream interface, not
# socket interface # socket interface
s.send(b"GET / HTTP/1.0\n\n") s.send(b"GET / HTTP/1.0\r\n\r\n")
print(s.recv(4096)) print(s.recv(4096))
s.close() s.close()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment