mkniskanen
Member since Nov 2022 • Last active Dec 2022Most recent activity
-
Well, for this project, the lack of SSL is not the killer. I can definitely do a lot at the remote server end (like limiting the access to an IP range), or possibly add an Nginx/PHP server as a mediator :)
Espruino is somewhat weird, but fun to work with, especially when writing the JS app in TypeScript. It is much move convenient than MicroPython, for instance. I like the event-driven approach.
-
Oh, I see, after finding the information accidentally: Hardly any boards can use HTTPS requests. I wish this fact had been written onto the http.request documentation. Now the information can only be found here: https://www.espruino.com/Internet#https and nowhere else.
Well, I experienced a moment of re-evaluation at this point. In private (unsecure) projects, I think http may work, though.
Anyhow, after such a good start I had, this was somewhat disappointing.
-
In my test script I have these options
var options = { host: 'badssl.com', port: 443, path: '/', method: 'GET', protocol: 'https:', };
and this code after the definition.
var req = require("http").request(options, function(res) { res.on('data', function(data) { console.log(res); console.log("HTTP> "+data); }); res.on('close', function(data) { console.log(res); console.log("Connection closed"); }); });
However, I keep getting a code 400 reply "The plain HTTP request was sent to HTTPS port". There are no redirects at the server end and I have tested the same functionality with my own server, address http://www.xdb.fi/dummy.txt - with the same result.
The script seems to be using http, despite all my attempts to switch to https. Do I have two blind eyes? I have one semi-blind already :)
Markku
A retired IT guy living in the woods and soldering with shaking hands.