Skip to content

Commit 204f360

Browse files
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
1 parent 3f06a38 commit 204f360

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

Diff for: libraries/HTTPClient/src/HTTPClient.cpp

+4
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,10 @@ bool HTTPClient::beginInternal(String url, const char* expectedProtocol)
261261
url.remove(0, (index + 3)); // remove http:// or https://
262262

263263
index = url.indexOf('/');
264+
if (index == -1) {
265+
index = url.length();
266+
url += '/';
267+
}
264268
String host = url.substring(0, index);
265269
url.remove(0, index); // remove host part
266270

0 commit comments

Comments
 (0)