ESP32 HTTPS Server
|
Main implementation for the plain HTTP server. Use HTTPSServer for TLS support. More...
#include <HTTPServer.hpp>
Public Member Functions | |
HTTPServer (const uint16_t portHTTPS=80, const uint8_t maxConnections=8, const in_addr_t bindAddress=0) | |
uint8_t | start () |
void | stop () |
bool | isRunning () |
void | loop () |
void | setDefaultHeader (std::string name, std::string value) |
![]() | |
void | registerNode (HTTPNode *node) |
void | unregisterNode (HTTPNode *node) |
void | setDefaultNode (HTTPNode *node) |
void | resolveNode (const std::string &method, const std::string &url, ResolvedResource &resolvedResource, HTTPNodeType nodeType) |
void | addMiddleware (const HTTPSMiddlewareFunction *mwFunction) |
void | removeMiddleware (const HTTPSMiddlewareFunction *mwFunction) |
const std::vector< HTTPSMiddlewareFunction * > | getMiddleware () |
Protected Member Functions | |
virtual uint8_t | setupSocket () |
virtual void | teardownSocket () |
virtual int | createConnection (int idx) |
Protected Attributes | |
const uint16_t | _port |
const uint8_t | _maxConnections |
const in_addr_t | _bindAddress |
HTTPConnection ** | _connections |
boolean | _running |
int | _socket |
sockaddr_in | _sock_addr |
HTTPHeaders | _defaultHeaders |
Main implementation for the plain HTTP server. Use HTTPSServer for TLS support.
void httpsserver::HTTPServer::loop | ( | ) |
The loop method can either be called by periodical interrupt or in the main loop and handles processing of data
void httpsserver::HTTPServer::setDefaultHeader | ( | std::string | name, |
std::string | value | ||
) |
Adds a default header that is included in every response.
This could be used for example to add a Server: header or for CORS options
|
protectedvirtual |
This method prepares the tcp server socket
uint8_t httpsserver::HTTPServer::start | ( | ) |
This method starts the server and begins to listen on the port
void httpsserver::HTTPServer::stop | ( | ) |
This method stops the server