1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-04-21 10:26:06 +03:00

Allow control over HTTPClient authorization String allocation (#8225)

This commit is contained in:
Paulo Cabral Sanz 2021-09-04 14:17:00 -03:00 committed by GitHub
parent 65db3aec72
commit 058ce7c08e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 4 deletions

View File

@ -276,17 +276,26 @@ void HTTPClient::setAuthorization(const char * user, const char * password)
}
/**
* set the Authorizatio for the http request
* set the Authorization for the http request
* @param auth const char * base64
*/
void HTTPClient::setAuthorization(const char * auth)
{
if(auth) {
_base64Authorization = auth;
_base64Authorization.replace(String('\n'), emptyString);
if (auth) {
setAuthorization(String(auth));
}
}
/**
* set the Authorization for the http request
* @param auth String base64
*/
void HTTPClient::setAuthorization(String auth)
{
_base64Authorization = std::move(auth);
_base64Authorization.replace(String('\n'), emptyString);
}
/**
* set the timeout for the TCP connection
* @param timeout unsigned int

View File

@ -176,6 +176,7 @@ public:
void setUserAgent(const String& userAgent);
void setAuthorization(const char * user, const char * password);
void setAuthorization(const char * auth);
void setAuthorization(String auth);
void setTimeout(uint16_t timeout);
// Redirections