pico-feedback
pico-feedback copied to clipboard
Example code has a unintended potential infinite loop
https://datasheets.raspberrypi.com/picow/connecting-to-the-internet-with-pico-w.pdf Page 24 line 50:
# We are not interested in HTTP request headers, skip them
while await reader.readline() != b"\r\n":
pass
Is is very possible a browser will send a empty request to the pico (that or something else on my network is doing it, but i doubt it)
This could be changed to this, if header==b"" it will be treated as False in the while condition
# We are not interested in HTTP request headers, skip them
header=await reader.readline()
while header and header != b"\r\n":
header=await reader.readline()
test code samples and output are in this thread:'https://forums.raspberrypi.com/viewtopic.php?t=341192