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