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:
parent
3f06a38f69
commit
204f360dce
1 changed files with 4 additions and 0 deletions
|
|
@ -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
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue