You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
import socket
import select
import ssl
proto, dummy, host, path = 'https://httpbin.org/post'.split('/', 3)
port = 443 if proto is 'https:' else 80
ai = socket.getaddrinfo(host, port, 0, socket.SOCK_STREAM)[0]
method = 'POST'
print(proto, host, path, port, method)
s = socket.socket(ai[0], ai[1], ai[2])
s.connect(ai[-1])
if proto == "https:":
s = ssl.wrap_socket(s, server_hostname=host)
p = select.poll()
p.register(s, select.POLLOUT)
go = True
while go:
for o, e in p.ipoll(250):
print(o, e)
if e & select.POLLOUT:
print('writing')
s.write(b'{0} /{1} HTTP/1.0\r\n'.format(method, path))
s.write(b'Host: {0}\r\n'.format(host))
s.write(b'Accept: application/json\r\n')
s.write(b'\r\n')
s.write(b'\r\n')
p.modify(s, select.POLLIN)
elif e & select.POLLIN:
print('reading')
s.read()
s.close()
p.unregister(s)
go = False
which on first run results in
https: httpbin.org post 443 POST
Traceback (most recent call last):
File "<stdin>", line 24, in <module>
OSError: [Errno 22] EINVAL
while running again ends in fatal exception:
https: httpbin.org post 443 POST
Fatal exception 29(StoreProhibitedCause):
epc1=0x4026c55c, epc2=0x00000000, epc3=0x00000000, excvaddr=0x00001440, depc=0x00000000
ets Jan 8 2013,rst cause:2, boot mode:(3,7)
load 0x40100000, len 30944, room 16
tail 0
chksum 0x92
load 0x3ffe8000, len 1084, room 8
tail 4
chksum 0x66
load 0x3ffe8440, len 3252, room 4
tail 0
chksum 0xc6
csum 0xc6
[gibberish...]
In http it runs fine — change https to http above like:
proto, dummy, host, path = 'http://httpbin.org/post'.split('/', 3)
I'm running this build esp8266-20180707-v1.9.4-244-g106e5945.bin because the stable esp8266-20180511-v1.9.4.bin does not allow me to detach repl from UART with uos.dupterm(None, 1)
My target is to send data to a REST API while polling at the same time UART for RFID reader data. My device is this
The text was updated successfully, but these errors were encountered:
Thanks for the report. I could reproduce the problems.
For the crashing when run a second time: this was because lwIP was calling a TCP callback on a socket that did no longer exist (it was executing it after a soft reset, on a socket that was made before soft reset). This was fixed in 4a2051e
For the case of polling ussl objects: this is covered by the existing issue #3394. I've now implemented that in 7a67f05, and so you should be able to poll ussl objects (on both esp8266 and esp32).
Hello,
please try this code:
which on first run results in
while running again ends in fatal exception:
In http it runs fine — change https to http above like:
proto, dummy, host, path = 'http://httpbin.org/post'.split('/', 3)
and you get the expected result:
I'm running this build
esp8266-20180707-v1.9.4-244-g106e5945.bin
because the stableesp8266-20180511-v1.9.4.bin
does not allow me to detach repl from UART withuos.dupterm(None, 1)
My target is to send data to a REST API while polling at the same time UART for RFID reader data. My device is this
The text was updated successfully, but these errors were encountered: