Append '/' to an URL with empty path in HTTPClient::begin (#5634)

* Add an error check for empty path of an URL

* Append '/' to an URL with empty path instead of returning an error
This commit is contained in:
long_long_float
2021-10-01 21:04:09 +09:00
committed by GitHub
parent 3f06a38f69
commit 204f360dce

View File

@ -261,6 +261,10 @@ bool HTTPClient::beginInternal(String url, const char* expectedProtocol)
url.remove(0, (index + 3)); // remove http:// or https://
index = url.indexOf('/');
if (index == -1) {
index = url.length();
url += '/';
}
String host = url.substring(0, index);
url.remove(0, index); // remove host part