ESP32 HTTPS Server
httpsserver::HTTPServer Class Reference

Main implementation for the plain HTTP server. Use HTTPSServer for TLS support. More...

#include <HTTPServer.hpp>

Inheritance diagram for httpsserver::HTTPServer:
Collaboration diagram for httpsserver::HTTPServer:

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)
- Public Member Functions inherited from httpsserver::ResourceResolver
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

Detailed Description

Main implementation for the plain HTTP server. Use HTTPSServer for TLS support.

Member Function Documentation

◆ loop()

void httpsserver::HTTPServer::loop ( )

The loop method can either be called by periodical interrupt or in the main loop and handles processing of data

◆ setDefaultHeader()

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

◆ setupSocket()

uint8_t httpsserver::HTTPServer::setupSocket ( )

This method prepares the tcp server socket

◆ start()

uint8_t httpsserver::HTTPServer::start ( )

This method starts the server and begins to listen on the port

◆ stop()

void httpsserver::HTTPServer::stop ( )

This method stops the server

The documentation for this class was generated from the following files: