5#ifndef WPINET_HTTPPARSER_H_
6#define WPINET_HTTPPARSER_H_
217 size_t m_maxLength = 1024;
218 enum { kStart, kUrl, kStatus, kField, kValue } m_state = kStart;
223 bool m_aborted =
false;
This file defines the SmallString class.
HTTP protocol parser.
Definition: HttpParser.h:24
bool IsUpgrade() const
Determine if an upgrade header was present and the parser has exited because of that.
Definition: HttpParser.h:118
sig::Signal< std::string_view, bool > body
Body data callback.
Definition: HttpParser.h:189
void SetMaxLength(size_t len)
Set the maximum accepted length for URLs, field names, and field values.
Definition: HttpParser.h:56
static uint32_t GetParserVersion()
Returns the library version.
sig::Signal< std::string_view > url
URL callback.
Definition: HttpParser.h:154
http_method GetMethod() const
Get HTTP method.
Definition: HttpParser.h:88
HttpParser(Type type)
Constructor.
bool HasError() const
Determine if an error occurred.
Definition: HttpParser.h:96
Type
Definition: HttpParser.h:26
@ kRequest
Definition: HttpParser.h:27
@ kResponse
Definition: HttpParser.h:28
@ kBoth
Definition: HttpParser.h:29
std::string_view Execute(std::string_view in)
Executes the parser.
Definition: HttpParser.h:63
sig::Signal< std::string_view > status
Status callback.
Definition: HttpParser.h:162
void Reset(Type type)
Reset the parser to initial state.
sig::Signal< bool > messageComplete
Headers complete callback.
Definition: HttpParser.h:199
http_errno GetError() const
Get error number.
Definition: HttpParser.h:101
unsigned int GetMajor() const
Get HTTP major version.
Definition: HttpParser.h:72
void Abort()
Abort the parse.
Definition: HttpParser.h:110
sig::Signal< std::string_view, std::string_view > header
Header field callback.
Definition: HttpParser.h:169
std::string_view GetUrl() const
Get URL.
Definition: HttpParser.h:142
sig::Signal chunkComplete
Chunk complete callback.
Definition: HttpParser.h:211
unsigned int GetMinor() const
Get HTTP minor version.
Definition: HttpParser.h:77
sig::Signal messageBegin
Message begin callback.
Definition: HttpParser.h:147
sig::Signal< uint64_t > chunkHeader
Chunk header callback.
Definition: HttpParser.h:206
sig::Signal< bool > headersComplete
Headers complete callback.
Definition: HttpParser.h:179
unsigned int GetStatusCode() const
Get HTTP status code.
Definition: HttpParser.h:83
bool ShouldKeepAlive() const
If this returns false in the headersComplete or messageComplete callback, then this should be the las...
Definition: HttpParser.h:126
bool IsBodyFinal() const
Checks if this is the final chunk of the body.
Definition: HttpParser.h:137
void Pause(bool paused)
Pause the parser.
Definition: HttpParser.h:132
std::string_view str() const
Explicit conversion to std::string_view.
Definition: SmallString.h:181
SignalBase is an implementation of the observer pattern, through the use of an emitting object and sl...
Definition: Signal.h:495
basic_string_view< char > string_view
Definition: core.h:520
type
Definition: core.h:575
::uint32_t uint32_t
Definition: Meta.h:56
/file This file defines the SmallVector class.
Definition: AprilTagFieldLayout.h:18
http_errno
Definition: http_parser.h:269
http_method
Definition: http_parser.h:194
size_t http_parser_execute(http_parser *parser, const http_parser_settings *settings, const char *data, size_t len)
@ HTTP_BOTH
Definition: http_parser.h:201
@ HTTP_REQUEST
Definition: http_parser.h:201
@ HTTP_RESPONSE
Definition: http_parser.h:201
int http_body_is_final(const http_parser *parser)
int http_should_keep_alive(const http_parser *parser)
void http_parser_pause(http_parser *parser, int paused)
Definition: http_parser.h:310
Definition: http_parser.h:279
unsigned int http_errno
Definition: http_parser.h:296
unsigned int method
Definition: http_parser.h:295
unsigned int upgrade
Definition: http_parser.h:303
unsigned short http_major
READ-ONLY.
Definition: http_parser.h:292
unsigned short http_minor
Definition: http_parser.h:293
unsigned int status_code
Definition: http_parser.h:294