From 0c897746e0475fd13f34efdef94b793a529750f5 Mon Sep 17 00:00:00 2001 From: Gordon Williams Date: Thu, 10 Oct 2024 10:48:31 +0100 Subject: [PATCH] Network: enable parsing of 'https' URL and TLS flag even even TLS not built in (#2410) --- ChangeLog | 2 ++ libs/network/jswrap_net.c | 2 -- libs/network/socketserver.c | 2 -- 3 files changed, 2 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 3ed3c4b982..e3ce712208 100644 --- a/ChangeLog +++ b/ChangeLog @@ -33,6 +33,8 @@ Graphic.createArrayBuffer msb now defaults to true as it's rare to ever need msb:false Ensure Math.random() can never be `1` as per spec (was unlikely before, but possible) Add Math.randInt: not in spec, but very useful for embedded + Fix debugging of switch statements (fix #2562) + Network: enable parsing of 'https' URL and TLS flag even even TLS not built in (#2410) 2v24 : Bangle.js2: Add 'Bangle.touchRd()', 'Bangle.touchWr()' Bangle.js2: After Bangle.showTestScreen, put Bangle.js into a hard off state (not soft off) diff --git a/libs/network/jswrap_net.c b/libs/network/jswrap_net.c index b2f9ce297c..f76c05c2e4 100644 --- a/libs/network/jswrap_net.c +++ b/libs/network/jswrap_net.c @@ -397,7 +397,6 @@ JsVar *jswrap_net_connect(JsVar *options, JsVar *callback, SocketType socketType jsError("Expecting Options to be an Object but it was %t", options); return 0; } -#ifdef USE_TLS if ((socketType&ST_TYPE_MASK) == ST_HTTP) { JsVar *protocol = jsvObjectGetChildIfExists(options, "protocol"); if (protocol && jsvIsStringEqual(protocol, "https:")) { @@ -405,7 +404,6 @@ JsVar *jswrap_net_connect(JsVar *options, JsVar *callback, SocketType socketType } jsvUnLock(protocol); } -#endif // Make sure we have a function as callback, or nothing (which is OK too) if (!jsvIsUndefined(callback) && !jsvIsFunction(callback)) { diff --git a/libs/network/socketserver.c b/libs/network/socketserver.c index 4286774bf0..e9cba43312 100644 --- a/libs/network/socketserver.c +++ b/libs/network/socketserver.c @@ -1048,11 +1048,9 @@ void clientRequestConnect(JsNetwork *net, JsVar *httpClientReqVar) { return; } -#ifdef USE_TLS if (socketType & ST_TLS) { if (port==0) port = 443; } -#endif if ((socketType&ST_TYPE_MASK) == ST_HTTP) { if (port==0) port = 80; }