Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitfa5ac67

Browse files
committed
examples/network/http_client*: Use \r\n line-endings in request.
1 parent3dabaae commitfa5ac67

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
ifuse_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)

[8]ページ先頭

©2009-2025 Movatter.jp