HttpConnection.h
Go to the documentation of this file.
35 HttpConnection(tcp_pcb* connection, http_parser_type type) : TcpClient(connection, nullptr, nullptr)
HttpConnectionState
Identifies current state for an HTTP connection.
Definition: HttpCommon.h:84
Provides http base used for client and server connections.
Definition: HttpConnection.h:28
void resetHeaders()
Called after all headers have been received and processed.
bool isActive()
virtual int onChunkHeader(http_parser *parser)
Definition: HttpConnection.h:119
virtual int onHeadersComplete(const HttpHeaders &headers)=0
Called when all headers are received.
static const http_parser_settings parserSettings
Callback table for parser.
Definition: HttpConnection.h:184
virtual void setDefaultParser()
HttpConnection(tcp_pcb *connection, http_parser_type type)
Definition: HttpConnection.h:35
virtual int onPath(const Url &uri)
Called when the URL path is known.
Definition: HttpConnection.h:102
virtual int onMessageBegin(http_parser *parser)=0
Called when a new incoming data is beginning to come.
virtual bool onTcpReceive(TcpClient &client, char *data, int size)
virtual int onChunkComplete(http_parser *parser)
Definition: HttpConnection.h:124
virtual int onBody(const char *at, size_t length)=0
Called when a piece of body data is received.
void onError(err_t err) override
virtual HttpRequest * getRequest()=0
Returns pointer to the current request.
virtual void init(http_parser_type type)
Initializes the http parser for a specific type of HTTP message.
HttpConnection(http_parser_type type, bool autoDestruct=false)
Definition: HttpConnection.h:30
HttpHeaders incomingHeaders
Full set of incoming headers.
Definition: HttpConnection.h:186
HttpResponse * getResponse()
Returns pointer to the current response.
Definition: HttpConnection.h:76
virtual int onMessageComplete(http_parser *parser)=0
Called when the incoming data is complete.
virtual bool onProtocolUpgrade(http_parser *parser)
Called when the HTTP protocol should be upgraded.
Definition: HttpConnection.h:148
Re-assembles headers from fragments via onHeaderField / onHeaderValue callbacks.
Definition: HttpHeaderBuilder.h:20
Represents either an incoming or outgoing response to a HTTP request.
Definition: HttpResponse.h:26
Definition: TcpClient.h:46
bool send(const char *data, uint16_t len, bool forceCloseAfterSent=false)