In adafruit_espatcontrol_socket.py the method connect() only sets the connection-type for the three ports 80, 443 and 1883. This triggers an exception socket_connect a few lines down.
IMHO this is anyhow the wrong osi-level to set the connection-type. It should be done within the requests-module. But adding an additional parameter in the request-module would need additional changes in other modules which implement connect().
The quick fix would be to just change the logic in connect(): use SSL for 443, TCP for other ports. This would fail for all sites running https on port 80 (but this already fails today).
Alternative solution: add a method set_conntype() to adafruit_espatcontrol.py and call this from adafruit_espatcontrol_wifimanager.py before calling requests.get() and so on. Conntype would be set depending on the url.
I can provide a pull request for both solutions. Any opinions?
In
adafruit_espatcontrol_socket.py
the methodconnect()
only sets the connection-type for the three ports 80, 443 and 1883. This triggers an exceptionsocket_connect
a few lines down.IMHO this is anyhow the wrong osi-level to set the connection-type. It should be done within the requests-module. But adding an additional parameter in the request-module would need additional changes in other modules which implement
connect()
.The quick fix would be to just change the logic in connect(): use SSL for 443, TCP for other ports. This would fail for all sites running https on port 80 (but this already fails today).
Alternative solution: add a method
set_conntype()
toadafruit_espatcontrol.py
and call this fromadafruit_espatcontrol_wifimanager.py
before callingrequests.get()
and so on. Conntype would be set depending on the url.I can provide a pull request for both solutions. Any opinions?