mirror of
https://github.com/0xFEEDC0DE64/arduino-esp32.git
synced 2025-07-05 14:56:32 +02:00
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:
@ -261,6 +261,10 @@ bool HTTPClient::beginInternal(String url, const char* expectedProtocol)
|
|||||||
url.remove(0, (index + 3)); // remove http:// or https://
|
url.remove(0, (index + 3)); // remove http:// or https://
|
||||||
|
|
||||||
index = url.indexOf('/');
|
index = url.indexOf('/');
|
||||||
|
if (index == -1) {
|
||||||
|
index = url.length();
|
||||||
|
url += '/';
|
||||||
|
}
|
||||||
String host = url.substring(0, index);
|
String host = url.substring(0, index);
|
||||||
url.remove(0, index); // remove host part
|
url.remove(0, index); // remove host part
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user