ESP32 HTTPS Server
httpsserver::HTTPConnection Class Reference

Represents a single open connection for the plain HTTPServer, without TLS. More...

#include <HTTPConnection.hpp>

Inheritance diagram for httpsserver::HTTPConnection:
Collaboration diagram for httpsserver::HTTPConnection:

Public Member Functions

 HTTPConnection (ResourceResolver *resResolver)
 
virtual int initialize (int serverSocketID, HTTPHeaders *defaultHeaders)
 
virtual void closeConnection ()
 
virtual bool isSecure ()
 
virtual IPAddress getClientIP ()
 
void loop ()
 
bool isClosed ()
 
bool isError ()
 

Protected Types

enum  {
  STATE_UNDEFINED, STATE_INITIAL, STATE_REQUEST_FINISHED, STATE_HEADERS_FINISHED,
  STATE_BODY_FINISHED, STATE_WEBSOCKET, STATE_CLOSING, STATE_CLOSED,
  STATE_ERROR
}
 
enum  { CSTATE_UNDEFINED, CSTATE_ACTIVE, CSTATE_CLOSED }
 

Protected Member Functions

virtual size_t writeBuffer (byte *buffer, size_t length)
 
virtual size_t readBytesToBuffer (byte *buffer, size_t length)
 
virtual bool canReadData ()
 
virtual size_t pendingByteCount ()
 

Protected Attributes

unsigned long _lastTransmissionTS
 
unsigned long _shutdownTS
 
enum httpsserver::HTTPConnection:: { ... }  _connectionState
 
enum httpsserver::HTTPConnection:: { ... }  _clientState
 

Friends

class HTTPRequest
 
class HTTPResponse
 
class WebsocketInputStreambuf
 

Detailed Description

Represents a single open connection for the plain HTTPServer, without TLS.

Member Function Documentation

◆ getClientIP()

IPAddress httpsserver::HTTPConnection::getClientIP ( )
virtual

Returns the client's IPv4

Implements httpsserver::ConnectionContext.

◆ initialize()

int httpsserver::HTTPConnection::initialize ( int  serverSocketID,
HTTPHeaders defaultHeaders 
)
virtual

Initializes the connection from a server socket.

The call WILL BLOCK if accept(serverSocketID) blocks. So use select() to check for that in advance.

◆ isClosed()

bool httpsserver::HTTPConnection::isClosed ( )

Returns true, if the connection has been closed.

◆ isError()

bool httpsserver::HTTPConnection::isError ( )

Returns true, if the connection has been closed due to error


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