1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-06-16 11:21:18 +03:00

Add SSL enabled WiFiServer, Updater, WebServer

Adds SSL server mode for WiFiServerSecure, for plain SSL connections,
ESP8266WebServerSecure, for HTTPS web serving, and SecureHTTPSUpdater for
encrypted OTA updates.

Example code is provided for all new options, as well as a BASH script for
generating their own, self-signed certificates.

Both ESP8266WebServerSecure and SecureHTTPSUpdater are important for secure
password-based authentication.  HTTP Basic Authentication, the only supported
model presently, sends the username and password in *cleartext* and therefore
should *never* be used in any un-SSL encrypted channel unless you don't mind
sharing your login and password with anyone else on the internet.  Even if the
ESP8266 is not safety critical, this cleartext broadcast could expose you should
you reuse this password elsewhere on your network or the internet.
This commit is contained in:
Earle F. Philhower, III
2017-02-27 20:17:04 -08:00
committed by Ivan Grokhotkov
parent 8765da258b
commit bd1c7ce1dc
17 changed files with 1049 additions and 29 deletions

View File

@ -71,12 +71,12 @@ class ESP8266WebServer
public:
ESP8266WebServer(IPAddress addr, int port = 80);
ESP8266WebServer(int port = 80);
~ESP8266WebServer();
virtual ~ESP8266WebServer();
void begin();
void handleClient();
virtual void begin();
virtual void handleClient();
void close();
virtual void close();
void stop();
bool authenticate(const char * username, const char * password);
@ -93,7 +93,7 @@ public:
String uri() { return _currentUri; }
HTTPMethod method() { return _currentMethod; }
WiFiClient client() { return _currentClient; }
virtual WiFiClient client() { return _currentClient; }
HTTPUpload& upload() { return *_currentUpload; }
String arg(String name); // get request argument value by name
@ -140,6 +140,8 @@ template<typename T> size_t streamFile(T &file, const String& contentType){
}
protected:
virtual size_t _currentClientWrite(const char* b, size_t l) { return _currentClient.write( b, l ); }
virtual size_t _currentClientWrite_P(PGM_P b, size_t l) { return _currentClient.write_P( b, l ); }
void _addRequestHandler(RequestHandler* handler);
void _handleRequest();
void _finalizeResponse();