Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions libraries/HTTPClient/src/HTTPClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,7 @@ bool HTTPClient::begin(String url, const char* CAcert)
end();
}

clear();
_port = 443;
if (!beginInternal(url, "https")) {
return false;
Expand All @@ -226,6 +227,7 @@ bool HTTPClient::begin(String url)
end();
}

clear();
_port = 80;
if (!beginInternal(url, "http")) {
return begin(url, (const char*)NULL);
Expand All @@ -243,7 +245,6 @@ bool HTTPClient::begin(String url)
bool HTTPClient::beginInternal(String url, const char* expectedProtocol)
{
log_v("url: %s", url.c_str());
clear();

// check for : (http: or https:
int index = url.indexOf(':');
Expand Down Expand Up @@ -1212,8 +1213,8 @@ int HTTPClient::handleHeaderResponse()
return HTTPC_ERROR_NOT_CONNECTED;
}

clear();

_returnCode = 0;
_size = -1;
_canReuse = _reuse;

String transferEncoding;
Expand Down