fix: duplicate User-Agent header on wolfSSL requests breaks strict servers (aiohttp 400) (#2661)
This commit is contained in:
@@ -58,7 +58,10 @@ HttpDownloader::DownloadError runGetWolf(const std::string& startUrl, const std:
|
|||||||
LOG_ERR("HTTP", "wolfSSL bad URL: %s", url.c_str());
|
LOG_ERR("HTTP", "wolfSSL bad URL: %s", url.c_str());
|
||||||
return HttpDownloader::HTTP_ERROR;
|
return HttpDownloader::HTTP_ERROR;
|
||||||
}
|
}
|
||||||
http.addHeader("User-Agent", "CrossPoint-ESP32-" CROSSPOINT_VERSION);
|
// setUserAgent replaces SecureHttpClient's built-in UA; addHeader would
|
||||||
|
// append a second User-Agent header, which strict servers reject (aiohttp
|
||||||
|
// answers 400 "Duplicate 'User-Agent' header found").
|
||||||
|
http.setUserAgent("CrossPoint-ESP32-" CROSSPOINT_VERSION);
|
||||||
if (!username.empty() && !password.empty()) {
|
if (!username.empty() && !password.empty()) {
|
||||||
const std::string credentials = username + ":" + password;
|
const std::string credentials = username + ":" + password;
|
||||||
const String encoded = base64::encode(credentials.c_str());
|
const String encoded = base64::encode(credentials.c_str());
|
||||||
|
|||||||
Reference in New Issue
Block a user