Skip to content

Don't clear custom HTTP headers on redirect in HTTPClient #5973

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 14, 2021
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