Parse array of name/value pairs as references to original data.
More...
#include <BasicHttpHeaders.h>
|
| Flag values providing additional information about header fields. More...
|
Parse array of name/value pairs as references to original data.
- Note
- When parsing a fixed block of text we don't need to make copies of the content, just nul-terminate the elements and build a list of references.
◆ BasicHttpHeaders()
BasicHttpHeaders::BasicHttpHeaders |
( |
| ) |
|
|
inline |
◆ clear()
void BasicHttpHeaders::clear |
( |
| ) |
|
◆ contains() [1/2]
bool BasicHttpHeaders::contains |
( |
const char * |
name | ) |
const |
|
inline |
◆ contains() [2/2]
◆ contentLength()
unsigned BasicHttpHeaders::contentLength |
( |
| ) |
const |
|
inline |
Obtain content length field value.
◆ count()
unsigned BasicHttpHeaders::count |
( |
| ) |
const |
|
inline |
Get number of parsed headers.
◆ method()
◆ operator[]() [1/4]
const Header& BasicHttpHeaders::operator[] |
( |
unsigned |
i | ) |
const |
|
inline |
◆ operator[]() [2/4]
const char*& BasicHttpHeaders::operator[] |
( |
const char * |
name | ) |
|
◆ operator[]() [3/4]
const char* BasicHttpHeaders::operator[] |
( |
const char * |
name | ) |
const |
Find a header by name.
- Parameters
-
- Return values
-
const | char* If found, the value, otherwise nullptr |
◆ operator[]() [4/4]
◆ parse()
HttpError BasicHttpHeaders::parse |
( |
char * |
data, |
|
|
size_t |
len, |
|
|
http_parser_type |
type = HTTP_BOTH |
|
) |
| |
Parse header data into name/value pairs.
- Parameters
-
data | |
len | |
type | Type of headers to parse. The default (HTTP_BOTH) detects this automatically, use type() to determine which. Specifying HTTP_REQUEST or HTTP_RESPONSE will only accept the given type and fail on mismatch. |
- Return values
-
- Note
- Content of provided data is modified to insert NUL terminators on string values Use type() method to determine whether it's a request or response
◆ setMethod()
void BasicHttpHeaders::setMethod |
( |
HttpMethod |
method | ) |
|
|
inline |
◆ status()
◆ toString()
String BasicHttpHeaders::toString |
( |
unsigned |
i | ) |
const |
|
inline |
◆ type()
http_parser_type BasicHttpHeaders::type |
( |
| ) |
const |
|
inline |
Get the type of message parsed.
- Return values
-
http_parser_type | either HTTP_REQUEST or HTTP_RESPONSE |
◆ maxValues
constexpr size_t BasicHttpHeaders::maxValues = 16 |
|
static |
The documentation for this class was generated from the following file: