Skip to content

Commit c8e15d1

Browse files
committed
Remove erroneous "unexpected protocol: https, expected http" warning
1 parent d982a96 commit c8e15d1

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/http/HTTPRequestManager.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,11 @@ HTTP::Response<std::size_t> _doGetStream(
365365
)
366366
{
367367
int64_t begin = OpenShock::millis();
368-
if (!client.begin(OpenShock::StringToArduinoString(url))) {
368+
369+
// This method is horribly named, if you call the begin() method with one String parameter its HTTP, but the one with (String, const char*) is HTTPS.
370+
// We pass null here for CAcert parameter to remove erroneous "unexpected protocol: https, expected http" warning, this is what begin(String) does as a fallback.
371+
// This is yet another example of why we need to get rid of Arduino dependency lol
372+
if (!client.begin(OpenShock::StringToArduinoString(url), nullptr)) {
369373
OS_LOGE(TAG, "Failed to begin HTTP request");
370374
return {HTTP::RequestResult::RequestFailed, 0, 0};
371375
}

0 commit comments

Comments
 (0)