My weather station code calls anAPI at www.myweather2.com. It worked great using HttpClient until recently when I started getting 303 errors. The URL it says to use is the same but it begins with HTTPS. I read the thread on the HTTPS library, understood very little of it and decided to try the example below first.
Well this is odd. There was apparently a Github issue about this code around the included URL being 404. So I followed the suggestion there and changed it to www.worldclockapi.com. Now when I run this program I get:
Using 2048 bit RSA private key
Keys Loaded
New Session key!:
free memory: 34464
[SOS-10 (assertion failure), followed by a reboot]
Trying it again, I get
Using 2048 bit RSA private key
Keys Loaded
New Session key!:
free memory: 34464
matrixSslNewClientSession:1
free memory 3: 34464
FAIL: No HTTP Response
followed by SOS-10 again.
My Photon is running f/w 1.4.0-rc.1. I also found another thread here with someone asking for a simple HTTPS example. He also received no replies.
UPDATE
Added a few printlns to the code and tried to flash/ This time it failed to flash at all because it couldn’t do OTA flashing, use particle update. Well that didn’t work either. But a reflash Tinker from my phone did work and then the above example code also flashed. Now I get this:
Using 2048 bit RSA private key
Keys Loaded
New Session key!:
Connected to host
free memory: 31576
matrixSslNewClientSession:1
free memory 3: 31576
Bytes sent Successfully?!: 98
matrixSslSentData: 0
Sent Successfully?!, everything good
matrixSslGetReadbuf: 6000
HttpClient> Done before full len
0
HttpClient> Done before full len
3894
Received: 3894
certCb invoked: 45
WARNING: Certificate date window validation not implemented
SUCCESS: Validated!
matrixSslReceivedData: Tx: 3894 Len: 0 rc: 1
So now all of a sudden it’s sort of working, I guess. But it still falls into SOS-10 right after that. Why?
Further Update
Apparently others are getting the same SOS-10 problem with this code. I regretfully conclude that the HTTPS library is unusable at this point. I guess I’ll have to find a weather API that does not use HTTPS.