diff --git a/libraries/ESP8266HTTPClient/src/ESP8266HTTPClient.cpp b/libraries/ESP8266HTTPClient/src/ESP8266HTTPClient.cpp index 61b9a8e4ff..a05b9dd6f0 100644 --- a/libraries/ESP8266HTTPClient/src/ESP8266HTTPClient.cpp +++ b/libraries/ESP8266HTTPClient/src/ESP8266HTTPClient.cpp @@ -113,8 +113,8 @@ class BearSSLTraits : public TransportTraits * constructor */ HTTPClient::HTTPClient() + : _client(nullptr), _userAgent(F("ESP8266HTTPClient")) { - _client = nullptr; #if HTTPCLIENT_1_1_COMPATIBLE _tcpDeprecated.reset(nullptr); #endif @@ -1294,21 +1294,21 @@ int HTTPClient::handleHeaderResponse() String headerValue = headerLine.substring(headerLine.indexOf(':') + 1); headerValue.trim(); - if(headerName.equalsIgnoreCase("Content-Length")) { + if(headerName.equalsIgnoreCase(F("Content-Length"))) { _size = headerValue.toInt(); } - if(_canReuse && headerName.equalsIgnoreCase("Connection")) { + if(_canReuse && headerName.equalsIgnoreCase(F("Connection"))) { if(headerValue.indexOf("close") >= 0 && headerValue.indexOf("keep-alive") < 0) { _canReuse = false; } } - if(headerName.equalsIgnoreCase("Transfer-Encoding")) { + if(headerName.equalsIgnoreCase(F("Transfer-Encoding"))) { transferEncoding = headerValue; } - if(headerName.equalsIgnoreCase("Location")) { + if(headerName.equalsIgnoreCase(F("Location"))) { _location = headerValue; } @@ -1334,7 +1334,7 @@ int HTTPClient::handleHeaderResponse() if(transferEncoding.length() > 0) { DEBUG_HTTPCLIENT("[HTTP-Client][handleHeaderResponse] Transfer-Encoding: %s\n", transferEncoding.c_str()); - if(transferEncoding.equalsIgnoreCase("chunked")) { + if(transferEncoding.equalsIgnoreCase(F("chunked"))) { _transferEncoding = HTTPC_TE_CHUNKED; } else { return HTTPC_ERROR_ENCODING; diff --git a/libraries/ESP8266HTTPClient/src/ESP8266HTTPClient.h b/libraries/ESP8266HTTPClient/src/ESP8266HTTPClient.h index 189070a986..d6e4f88c0a 100644 --- a/libraries/ESP8266HTTPClient/src/ESP8266HTTPClient.h +++ b/libraries/ESP8266HTTPClient/src/ESP8266HTTPClient.h @@ -242,7 +242,7 @@ class HTTPClient String _uri; String _protocol; String _headers; - String _userAgent = "ESP8266HTTPClient"; + String _userAgent; String _base64Authorization; /// Response handling diff --git a/libraries/ESP8266WebServer/src/Parsing-impl.h b/libraries/ESP8266WebServer/src/Parsing-impl.h index c6b8ea16e7..decc9c8e0b 100644 --- a/libraries/ESP8266WebServer/src/Parsing-impl.h +++ b/libraries/ESP8266WebServer/src/Parsing-impl.h @@ -238,7 +238,7 @@ bool ESP8266WebServerTemplate::_parseRequest(ClientType& client) { DEBUG_OUTPUT.println(headerValue); #endif - if (headerName.equalsIgnoreCase("Host")){ + if (headerName.equalsIgnoreCase(F("Host"))){ _hostHeader = headerValue; } } diff --git a/libraries/ESP8266WiFi/src/ESP8266WiFi.cpp b/libraries/ESP8266WiFi/src/ESP8266WiFi.cpp index 146c968a58..8f63a97fa6 100644 --- a/libraries/ESP8266WiFi/src/ESP8266WiFi.cpp +++ b/libraries/ESP8266WiFi/src/ESP8266WiFi.cpp @@ -49,24 +49,24 @@ extern "C" { * @param p Print interface */ void ESP8266WiFiClass::printDiag(Print& p) { - const char* modes[] = { "NULL", "STA", "AP", "STA+AP" }; - p.print("Mode: "); + const char* const modes[] = { "NULL", "STA", "AP", "STA+AP" }; + p.print(F("Mode: ")); p.println(modes[wifi_get_opmode()]); - const char* phymodes[] = { "", "B", "G", "N" }; - p.print("PHY mode: "); + const char* const phymodes[] = { "", "B", "G", "N" }; + p.print(F("PHY mode: ")); p.println(phymodes[(int) wifi_get_phy_mode()]); - p.print("Channel: "); + p.print(F("Channel: ")); p.println(wifi_get_channel()); - p.print("AP id: "); + p.print(F("AP id: ")); p.println(wifi_station_get_current_ap_id()); - p.print("Status: "); + p.print(F("Status: ")); p.println(wifi_station_get_connect_status()); - p.print("Auto connect: "); + p.print(F("Auto connect: ")); p.println(wifi_station_get_auto_connect()); struct station_config conf; @@ -75,22 +75,14 @@ void ESP8266WiFiClass::printDiag(Print& p) { char ssid[33]; //ssid can be up to 32chars, => plus null term memcpy(ssid, conf.ssid, sizeof(conf.ssid)); ssid[32] = 0; //nullterm in case of 32 char ssid - - p.print("SSID ("); - p.print(strlen(ssid)); - p.print("): "); - p.println(ssid); + p.printf_P(PSTR("SSID (%d): %s\n"), strlen(ssid), ssid); char passphrase[65]; memcpy(passphrase, conf.password, sizeof(conf.password)); passphrase[64] = 0; + p.printf_P(PSTR("Passphrase (%d): %s\n"), strlen(passphrase), passphrase); - p.print("Passphrase ("); - p.print(strlen(passphrase)); - p.print("): "); - p.println(passphrase); - - p.print("BSSID set: "); + p.print(F("BSSID set: ")); p.println(conf.bssid_set); }