Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit cb25fe8

Browse filesBrowse files
authored
Don't clear headers on redirect (espressif#5973)
Current implementation clears _headers when request was sent. If the user added custom request headers, they will be lost and the redirected request will not contain them. This commit changes the scope of cleanup so that the headers survive redirects but don't survive connection reuse.
1 parent f5b04b9 commit cb25fe8
Copy full SHA for cb25fe8

File tree

1 file changed

+4
-3
lines changed
Filter options

1 file changed

+4
-3
lines changed

‎libraries/HTTPClient/src/HTTPClient.cpp

Copy file name to clipboardExpand all lines: libraries/HTTPClient/src/HTTPClient.cpp
+4-3Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,7 @@ bool HTTPClient::begin(String url, const char* CAcert)
200200
end();
201201
}
202202

203+
clear();
203204
_port = 443;
204205
if (!beginInternal(url, "https")) {
205206
return false;
@@ -226,6 +227,7 @@ bool HTTPClient::begin(String url)
226227
end();
227228
}
228229

230+
clear();
229231
_port = 80;
230232
if (!beginInternal(url, "http")) {
231233
return begin(url, (const char*)NULL);
@@ -243,7 +245,6 @@ bool HTTPClient::begin(String url)
243245
bool HTTPClient::beginInternal(String url, const char* expectedProtocol)
244246
{
245247
log_v("url: %s", url.c_str());
246-
clear();
247248

248249
// check for : (http: or https:
249250
int index = url.indexOf(':');
@@ -1212,8 +1213,8 @@ int HTTPClient::handleHeaderResponse()
12121213
return HTTPC_ERROR_NOT_CONNECTED;
12131214
}
12141215

1215-
clear();
1216-
1216+
_returnCode = 0;
1217+
_size = -1;
12171218
_canReuse = _reuse;
12181219

12191220
String transferEncoding;

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.