Crow  1.1
A C++ microframework for the web
crow::HTTPParser< Handler > Struct Template Reference

A wrapper for nodejs/http-parser. More...

#include <parser.h>

Inheritance diagram for crow::HTTPParser< Handler >:
crow::http_parser

Public Member Functions

 HTTPParser (Handler *handler)
 
bool feed (const char *buffer, int length)
 Parse a buffer into the different sections of an HTTP request.
 
bool done ()
 
void clear ()
 
void process_url ()
 
void process_header ()
 
void process_message ()
 
void set_connection_parameters ()
 

Static Public Member Functions

static int on_message_begin (http_parser *)
 
static int on_method (http_parser *self_)
 
static int on_url (http_parser *self_, const char *at, size_t length)
 
static int on_header_field (http_parser *self_, const char *at, size_t length)
 
static int on_header_value (http_parser *self_, const char *at, size_t length)
 
static int on_headers_complete (http_parser *self_)
 
static int on_body (http_parser *self_, const char *at, size_t length)
 
static int on_message_complete (http_parser *self_)
 

Public Attributes

request req
 
- Public Attributes inherited from crow::http_parser
unsigned int flags: 7
 
unsigned int state: 8
 
unsigned int header_state: 7
 
unsigned int index: 5
 
unsigned int uses_transfer_encoding: 1
 
unsigned int allow_chunked_length: 1
 
unsigned int lenient_http_headers: 1
 
uint32_t nread
 
uint64_t content_length
 
unsigned long qs_point
 
unsigned char http_major
 
unsigned char http_minor
 
unsigned int method: 8
 
unsigned int http_errno: 7
 
unsigned int upgrade: 1
 
void * data
 

Detailed Description

template<typename Handler>
struct crow::HTTPParser< Handler >

A wrapper for nodejs/http-parser.

Used to generate a crow::request from the TCP socket buffer.

Member Data Documentation

◆ req

template<typename Handler >
request crow::HTTPParser< Handler >::req

The final request that this parser outputs.

Data parsed is put directly into this object as soon as the related callback returns. (e.g. the request will have the cooorect method as soon as on_method() returns)


The documentation for this struct was generated from the following file: