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