AusweisApp2
http_parser.h
gehe zur Dokumentation dieser Datei
1 /* Copyright Joyent, Inc. and other Node contributors. All rights reserved.
2  *
3  * Permission is hereby granted, free of charge, to any person obtaining a copy
4  * of this software and associated documentation files (the "Software"), to
5  * deal in the Software without restriction, including without limitation the
6  * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
7  * sell copies of the Software, and to permit persons to whom the Software is
8  * furnished to do so, subject to the following conditions:
9  *
10  * The above copyright notice and this permission notice shall be included in
11  * all copies or substantial portions of the Software.
12  *
13  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
18  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
19  * IN THE SOFTWARE.
20  */
21 #ifndef http_parser_h
22 #define http_parser_h
23 #ifdef __cplusplus
24 extern "C" {
25 #endif
26 
27 /* Also update SONAME in the Makefile whenever you change these. */
28 #define HTTP_PARSER_VERSION_MAJOR 2
29 #define HTTP_PARSER_VERSION_MINOR 9
30 #define HTTP_PARSER_VERSION_PATCH 4
31 
32 #include <stddef.h>
33 #if defined(_WIN32) && !defined(__MINGW32__) && \
34  (!defined(_MSC_VER) || _MSC_VER<1600) && !defined(__WINE__)
35 #include <BaseTsd.h>
36 typedef __int8 int8_t;
37 typedef unsigned __int8 uint8_t;
38 typedef __int16 int16_t;
39 typedef unsigned __int16 uint16_t;
40 typedef __int32 int32_t;
41 typedef unsigned __int32 uint32_t;
42 typedef __int64 int64_t;
43 typedef unsigned __int64 uint64_t;
44 #else
45 #include <stdint.h>
46 #endif
47 
48 /* Compile with -DHTTP_PARSER_STRICT=0 to make less checks, but run
49  * faster
50  */
51 #ifndef HTTP_PARSER_STRICT
52 # define HTTP_PARSER_STRICT 1
53 #endif
54 
55 /* Maximium header size allowed. If the macro is not defined
56  * before including this header then the default is used. To
57  * change the maximum header size, define the macro in the build
58  * environment (e.g. -DHTTP_MAX_HEADER_SIZE=<value>). To remove
59  * the effective limit on the size of the header, define the macro
60  * to a very large number (e.g. -DHTTP_MAX_HEADER_SIZE=0x7fffffff)
61  */
62 #ifndef HTTP_MAX_HEADER_SIZE
63 # define HTTP_MAX_HEADER_SIZE (80*1024)
64 #endif
65 
66 typedef struct http_parser http_parser;
68 
69 
70 /* Callbacks should return non-zero to indicate an error. The parser will
71  * then halt execution.
72  *
73  * The one exception is on_headers_complete. In a HTTP_RESPONSE parser
74  * returning '1' from on_headers_complete will tell the parser that it
75  * should not expect a body. This is used when receiving a response to a
76  * HEAD request which may contain 'Content-Length' or 'Transfer-Encoding:
77  * chunked' headers that indicate the presence of a body.
78  *
79  * Returning `2` from on_headers_complete will tell parser that it should not
80  * expect neither a body nor any futher responses on this connection. This is
81  * useful for handling responses to a CONNECT request which may not contain
82  * `Upgrade` or `Connection: upgrade` headers.
83  *
84  * http_data_cb does not return data chunks. It will be called arbitrarily
85  * many times for each string. E.G. you might get 10 callbacks for "on_url"
86  * each providing just a few characters more data.
87  */
88 typedef int (*http_data_cb) (http_parser*, const char *at, size_t length);
89 typedef int (*http_cb) (http_parser*);
90 
91 
92 /* Status Codes */
93 #define HTTP_STATUS_MAP(XX) \
94  XX(100, CONTINUE, Continue) \
95  XX(101, SWITCHING_PROTOCOLS, Switching Protocols) \
96  XX(102, PROCESSING, Processing) \
97  XX(200, OK, OK) \
98  XX(201, CREATED, Created) \
99  XX(202, ACCEPTED, Accepted) \
100  XX(203, NON_AUTHORITATIVE_INFORMATION, Non-Authoritative Information) \
101  XX(204, NO_CONTENT, No Content) \
102  XX(205, RESET_CONTENT, Reset Content) \
103  XX(206, PARTIAL_CONTENT, Partial Content) \
104  XX(207, MULTI_STATUS, Multi-Status) \
105  XX(208, ALREADY_REPORTED, Already Reported) \
106  XX(226, IM_USED, IM Used) \
107  XX(300, MULTIPLE_CHOICES, Multiple Choices) \
108  XX(301, MOVED_PERMANENTLY, Moved Permanently) \
109  XX(302, FOUND, Found) \
110  XX(303, SEE_OTHER, See Other) \
111  XX(304, NOT_MODIFIED, Not Modified) \
112  XX(305, USE_PROXY, Use Proxy) \
113  XX(307, TEMPORARY_REDIRECT, Temporary Redirect) \
114  XX(308, PERMANENT_REDIRECT, Permanent Redirect) \
115  XX(400, BAD_REQUEST, Bad Request) \
116  XX(401, UNAUTHORIZED, Unauthorized) \
117  XX(402, PAYMENT_REQUIRED, Payment Required) \
118  XX(403, FORBIDDEN, Forbidden) \
119  XX(404, NOT_FOUND, Not Found) \
120  XX(405, METHOD_NOT_ALLOWED, Method Not Allowed) \
121  XX(406, NOT_ACCEPTABLE, Not Acceptable) \
122  XX(407, PROXY_AUTHENTICATION_REQUIRED, Proxy Authentication Required) \
123  XX(408, REQUEST_TIMEOUT, Request Timeout) \
124  XX(409, CONFLICT, Conflict) \
125  XX(410, GONE, Gone) \
126  XX(411, LENGTH_REQUIRED, Length Required) \
127  XX(412, PRECONDITION_FAILED, Precondition Failed) \
128  XX(413, PAYLOAD_TOO_LARGE, Payload Too Large) \
129  XX(414, URI_TOO_LONG, URI Too Long) \
130  XX(415, UNSUPPORTED_MEDIA_TYPE, Unsupported Media Type) \
131  XX(416, RANGE_NOT_SATISFIABLE, Range Not Satisfiable) \
132  XX(417, EXPECTATION_FAILED, Expectation Failed) \
133  XX(421, MISDIRECTED_REQUEST, Misdirected Request) \
134  XX(422, UNPROCESSABLE_ENTITY, Unprocessable Entity) \
135  XX(423, LOCKED, Locked) \
136  XX(424, FAILED_DEPENDENCY, Failed Dependency) \
137  XX(426, UPGRADE_REQUIRED, Upgrade Required) \
138  XX(428, PRECONDITION_REQUIRED, Precondition Required) \
139  XX(429, TOO_MANY_REQUESTS, Too Many Requests) \
140  XX(431, REQUEST_HEADER_FIELDS_TOO_LARGE, Request Header Fields Too Large) \
141  XX(451, UNAVAILABLE_FOR_LEGAL_REASONS, Unavailable For Legal Reasons) \
142  XX(500, INTERNAL_SERVER_ERROR, Internal Server Error) \
143  XX(501, NOT_IMPLEMENTED, Not Implemented) \
144  XX(502, BAD_GATEWAY, Bad Gateway) \
145  XX(503, SERVICE_UNAVAILABLE, Service Unavailable) \
146  XX(504, GATEWAY_TIMEOUT, Gateway Timeout) \
147  XX(505, HTTP_VERSION_NOT_SUPPORTED, HTTP Version Not Supported) \
148  XX(506, VARIANT_ALSO_NEGOTIATES, Variant Also Negotiates) \
149  XX(507, INSUFFICIENT_STORAGE, Insufficient Storage) \
150  XX(508, LOOP_DETECTED, Loop Detected) \
151  XX(510, NOT_EXTENDED, Not Extended) \
152  XX(511, NETWORK_AUTHENTICATION_REQUIRED, Network Authentication Required) \
153 
155  {
156 #define XX(num, name, string) HTTP_STATUS_##name = num,
158 #undef XX
159  };
160 
161 
162 /* Request Methods */
163 #define HTTP_METHOD_MAP(XX) \
164  XX(0, DELETE, DELETE) \
165  XX(1, GET, GET) \
166  XX(2, HEAD, HEAD) \
167  XX(3, POST, POST) \
168  XX(4, PUT, PUT) \
169  /* pathological */ \
170  XX(5, CONNECT, CONNECT) \
171  XX(6, OPTIONS, OPTIONS) \
172  XX(7, TRACE, TRACE) \
173  /* WebDAV */ \
174  XX(8, COPY, COPY) \
175  XX(9, LOCK, LOCK) \
176  XX(10, MKCOL, MKCOL) \
177  XX(11, MOVE, MOVE) \
178  XX(12, PROPFIND, PROPFIND) \
179  XX(13, PROPPATCH, PROPPATCH) \
180  XX(14, SEARCH, SEARCH) \
181  XX(15, UNLOCK, UNLOCK) \
182  XX(16, BIND, BIND) \
183  XX(17, REBIND, REBIND) \
184  XX(18, UNBIND, UNBIND) \
185  XX(19, ACL, ACL) \
186  /* subversion */ \
187  XX(20, REPORT, REPORT) \
188  XX(21, MKACTIVITY, MKACTIVITY) \
189  XX(22, CHECKOUT, CHECKOUT) \
190  XX(23, MERGE, MERGE) \
191  /* upnp */ \
192  XX(24, MSEARCH, M-SEARCH) \
193  XX(25, NOTIFY, NOTIFY) \
194  XX(26, SUBSCRIBE, SUBSCRIBE) \
195  XX(27, UNSUBSCRIBE, UNSUBSCRIBE) \
196  /* RFC-5789 */ \
197  XX(28, PATCH, PATCH) \
198  XX(29, PURGE, PURGE) \
199  /* CalDAV */ \
200  XX(30, MKCALENDAR, MKCALENDAR) \
201  /* RFC-2068, section 19.6.1.2 */ \
202  XX(31, LINK, LINK) \
203  XX(32, UNLINK, UNLINK) \
204  /* icecast */ \
205  XX(33, SOURCE, SOURCE) \
206 
208  {
209 #define XX(num, name, string) HTTP_##name = num,
211 #undef XX
212  };
213 
214 
216 
217 
218 /* Flag values for http_parser.flags field */
219 enum flags
220  { F_CHUNKED = 1 << 0
224  , F_TRAILING = 1 << 4
225  , F_UPGRADE = 1 << 5
226  , F_SKIPBODY = 1 << 6
227  , F_CONTENTLENGTH = 1 << 7
228  , F_TRANSFER_ENCODING = 1 << 8 /* Never set in http_parser.flags */
229  };
230 
231 
232 /* Map for errno-related constants
233  *
234  * The provided argument should be a macro that takes 2 arguments.
235  */
236 #define HTTP_ERRNO_MAP(XX) \
237  /* No error */ \
238  XX(OK, "success") \
239  \
240  /* Callback-related errors */ \
241  XX(CB_message_begin, "the on_message_begin callback failed") \
242  XX(CB_url, "the on_url callback failed") \
243  XX(CB_header_field, "the on_header_field callback failed") \
244  XX(CB_header_value, "the on_header_value callback failed") \
245  XX(CB_headers_complete, "the on_headers_complete callback failed") \
246  XX(CB_body, "the on_body callback failed") \
247  XX(CB_message_complete, "the on_message_complete callback failed") \
248  XX(CB_status, "the on_status callback failed") \
249  XX(CB_chunk_header, "the on_chunk_header callback failed") \
250  XX(CB_chunk_complete, "the on_chunk_complete callback failed") \
251  \
252  /* Parsing-related errors */ \
253  XX(INVALID_EOF_STATE, "stream ended at an unexpected time") \
254  XX(HEADER_OVERFLOW, \
255  "too many header bytes seen; overflow detected") \
256  XX(CLOSED_CONNECTION, \
257  "data received after completed connection: close message") \
258  XX(INVALID_VERSION, "invalid HTTP version") \
259  XX(INVALID_STATUS, "invalid HTTP status code") \
260  XX(INVALID_METHOD, "invalid HTTP method") \
261  XX(INVALID_URL, "invalid URL") \
262  XX(INVALID_HOST, "invalid host") \
263  XX(INVALID_PORT, "invalid port") \
264  XX(INVALID_PATH, "invalid path") \
265  XX(INVALID_QUERY_STRING, "invalid query string") \
266  XX(INVALID_FRAGMENT, "invalid fragment") \
267  XX(LF_EXPECTED, "LF character expected") \
268  XX(INVALID_HEADER_TOKEN, "invalid character in header") \
269  XX(INVALID_CONTENT_LENGTH, \
270  "invalid character in content-length header") \
271  XX(UNEXPECTED_CONTENT_LENGTH, \
272  "unexpected content-length header") \
273  XX(INVALID_CHUNK_SIZE, \
274  "invalid character in chunk size header") \
275  XX(INVALID_CONSTANT, "invalid constant string") \
276  XX(INVALID_INTERNAL_STATE, "encountered unexpected internal state")\
277  XX(STRICT, "strict mode assertion failed") \
278  XX(PAUSED, "parser is paused") \
279  XX(UNKNOWN, "an unknown error occurred") \
280  XX(INVALID_TRANSFER_ENCODING, \
281  "request has invalid transfer-encoding") \
282 
283 
284 /* Define HPE_* values for each errno value above */
285 #define HTTP_ERRNO_GEN(n, s) HPE_##n,
288 };
289 #undef HTTP_ERRNO_GEN
290 
291 
292 /* Get an http_errno value from an http_parser */
293 #define HTTP_PARSER_ERRNO(p) ((enum http_errno) (p)->http_errno)
294 
295 
296 struct http_parser {
298  unsigned int type : 2; /* enum http_parser_type */
299  unsigned int flags : 8; /* F_* values from 'flags' enum; semi-public */
300  unsigned int state : 7; /* enum state from http_parser.c */
301  unsigned int header_state : 7; /* enum header_state from http_parser.c */
302  unsigned int index : 5; /* index into current matcher */
303  unsigned int extra_flags : 2;
304  unsigned int lenient_http_headers : 1;
305 
306  uint32_t nread; /* # bytes read in various scenarios */
307  uint64_t content_length; /* # bytes in body (0 if no Content-Length header) */
308 
310  unsigned short http_major;
311  unsigned short http_minor;
312  unsigned int status_code : 16; /* responses only */
313  unsigned int method : 8; /* requests only */
314  unsigned int http_errno : 7;
315 
316  /* 1 = Upgrade header was present and the parser has exited because of that.
317  * 0 = No upgrade header present.
318  * Should be checked when http_parser_execute() returns in addition to
319  * error checking.
320  */
321  unsigned int upgrade : 1;
322 
324  void *data; /* A pointer to get hook to the "connection" or "socket" object */
325 };
326 
327 
337  /* When on_chunk_header is called, the current chunk length is stored
338  * in parser->content_length.
339  */
342 };
343 
344 
346  { UF_SCHEMA = 0
347  , UF_HOST = 1
348  , UF_PORT = 2
349  , UF_PATH = 3
350  , UF_QUERY = 4
353  , UF_MAX = 7
354  };
355 
356 
357 /* Result structure for http_parser_parse_url().
358  *
359  * Callers should index into field_data[] with UF_* values iff field_set
360  * has the relevant (1 << UF_*) bit set. As a courtesy to clients (and
361  * because we probably have padding left over), we convert any port to
362  * a uint16_t.
363  */
365  uint16_t field_set; /* Bitmask of (1 << UF_*) values */
366  uint16_t port; /* Converted UF_PORT string */
367 
368  struct {
369  uint16_t off; /* Offset into buffer in which field starts */
370  uint16_t len; /* Length of run in buffer */
372 };
373 
374 
375 /* Returns the library version. Bits 16-23 contain the major version number,
376  * bits 8-15 the minor version number and bits 0-7 the patch level.
377  * Usage example:
378  *
379  * unsigned long version = http_parser_version();
380  * unsigned major = (version >> 16) & 255;
381  * unsigned minor = (version >> 8) & 255;
382  * unsigned patch = version & 255;
383  * printf("http_parser v%u.%u.%u\n", major, minor, patch);
384  */
385 unsigned long http_parser_version(void);
386 
387 void http_parser_init(http_parser *parser, enum http_parser_type type);
388 
389 
390 /* Initialize http_parser_settings members to 0
391  */
393 
394 
395 /* Executes the parser. Returns number of parsed bytes. Sets
396  * `parser->http_errno` on error. */
397 size_t http_parser_execute(http_parser *parser,
398  const http_parser_settings *settings,
399  const char *data,
400  size_t len);
401 
402 
403 /* If http_should_keep_alive() in the on_headers_complete or
404  * on_message_complete callback returns 0, then this should be
405  * the last message on the connection.
406  * If you are the server, respond with the "Connection: close" header.
407  * If you are the client, close the connection.
408  */
409 int http_should_keep_alive(const http_parser *parser);
410 
411 /* Returns a string version of the HTTP method. */
412 const char *http_method_str(enum http_method m);
413 
414 /* Returns a string version of the HTTP status code. */
415 const char *http_status_str(enum http_status s);
416 
417 /* Return a string name of the given error */
418 const char *http_errno_name(enum http_errno err);
419 
420 /* Return a string description of the given error */
421 const char *http_errno_description(enum http_errno err);
422 
423 /* Initialize all http_parser_url members to 0 */
424 void http_parser_url_init(struct http_parser_url *u);
425 
426 /* Parse a URL; return nonzero on failure */
427 int http_parser_parse_url(const char *buf, size_t buflen,
428  int is_connect,
429  struct http_parser_url *u);
430 
431 /* Pause or un-pause the parser; a nonzero value pauses */
432 void http_parser_pause(http_parser *parser, int paused);
433 
434 /* Checks if this is the final chunk of the body. */
435 int http_body_is_final(const http_parser *parser);
436 
437 /* Change the maximum header size provided at compile time. */
438 void http_parser_set_max_header_size(uint32_t size);
439 
440 #ifdef __cplusplus
441 }
442 #endif
443 #endif
s_http_host_dead
@ s_http_host_dead
Definition: http_parser.cpp:402
http_parser_pause
void http_parser_pause(http_parser *parser, int paused)
Definition: http_parser.cpp:2539
s_res_first_status_code
@ s_res_first_status_code
Definition: http_parser.cpp:293
h_C
@ h_C
Definition: http_parser.cpp:367
h_general
@ h_general
Definition: http_parser.cpp:366
s_http_host_v6_end
@ s_http_host_v6_end
Definition: http_parser.cpp:409
http_parser_settings::on_message_begin
http_cb on_message_begin
Definition: http_parser.h:329
http_parser_settings::on_message_complete
http_cb on_message_complete
Definition: http_parser.h:336
XX
#define XX(num, name, string)
Definition: http_parser.h:209
HTTP_PARSER_VERSION_MAJOR
#define HTTP_PARSER_VERSION_MAJOR
Definition: http_parser.h:28
s_res_HT
@ s_res_HT
Definition: http_parser.cpp:286
PARSING_HEADER
#define PARSING_HEADER(state)
Definition: http_parser.cpp:362
h_connection
@ h_connection
Definition: http_parser.cpp:377
COUNT_HEADER_SIZE
#define COUNT_HEADER_SIZE(V)
Definition: http_parser.cpp:154
http_status_str
const char * http_status_str(enum http_status s)
Definition: http_parser.cpp:2207
PROXY_CONNECTION
#define PROXY_CONNECTION
Definition: http_parser.cpp:164
IS_HEX
#define IS_HEX(c)
Definition: http_parser.cpp:423
s_header_field_start
@ s_header_field_start
Definition: http_parser.cpp:327
F_TRAILING
@ F_TRAILING
Definition: http_parser.h:224
s_req_http_dot
@ s_req_http_dot
Definition: http_parser.cpp:322
http_method_str
const char * http_method_str(enum http_method m)
Definition: http_parser.cpp:2201
http_parser_settings::on_header_field
http_data_cb on_header_field
Definition: http_parser.h:332
s_body_identity
@ s_body_identity
Definition: http_parser.cpp:355
http_parser_settings::on_chunk_header
http_cb on_chunk_header
Definition: http_parser.h:340
http_body_is_final
int http_body_is_final(const struct http_parser *parser)
Definition: http_parser.cpp:2554
CONTENT_LENGTH
#define CONTENT_LENGTH
Definition: http_parser.cpp:166
h_content_length
@ h_content_length
Definition: http_parser.cpp:378
s_http_host_port_start
@ s_http_host_port_start
Definition: http_parser.cpp:412
h_content_length_ws
@ h_content_length_ws
Definition: http_parser.cpp:380
http_should_keep_alive
int http_should_keep_alive(const http_parser *parser)
Definition: http_parser.cpp:2182
http_parser
Definition: http_parser.h:296
s_req_spaces_before_url
@ s_req_spaces_before_url
Definition: http_parser.cpp:302
flags
flags
Definition: http_parser.h:220
s_http_host_v6_zone_start
@ s_http_host_v6_zone_start
Definition: http_parser.cpp:410
h_upgrade
@ h_upgrade
Definition: http_parser.cpp:382
http_parser_version
unsigned long http_parser_version(void)
Definition: http_parser.cpp:2559
s_req_http_I
@ s_req_http_I
Definition: http_parser.cpp:319
http_host_state
http_host_state
Definition: http_parser.cpp:401
IS_ALPHANUM
#define IS_ALPHANUM(c)
Definition: http_parser.cpp:422
http_parser::http_errno
unsigned int http_errno
Definition: http_parser.h:314
s_start_req
@ s_start_req
Definition: http_parser.cpp:299
s_start_req_or_res
@ s_start_req_or_res
Definition: http_parser.cpp:282
IS_URL_CHAR
#define IS_URL_CHAR(c)
Definition: http_parser.cpp:435
http_status
http_status
Definition: http_parser.h:155
http_parser_version
unsigned long http_parser_version(void)
Definition: http_parser.cpp:2559
http_parser_settings::on_headers_complete
http_cb on_headers_complete
Definition: http_parser.h:334
h_matching_transfer_encoding
@ h_matching_transfer_encoding
Definition: http_parser.cpp:374
NEW_MESSAGE
#define NEW_MESSAGE()
Definition: http_parser.cpp:463
s_req_http_IC
@ s_req_http_IC
Definition: http_parser.cpp:320
s_res_status
@ s_res_status
Definition: http_parser.cpp:296
LF
#define LF
Definition: http_parser.cpp:418
ULLONG_MAX
#define ULLONG_MAX
Definition: http_parser.cpp:31
http_status_str
const char * http_status_str(enum http_status s)
Definition: http_parser.cpp:2207
s_req_query_string_start
@ s_req_query_string_start
Definition: http_parser.cpp:310
http_parser_set_max_header_size
void http_parser_set_max_header_size(uint32_t size)
Definition: http_parser.cpp:2566
IS_ALPHA
#define IS_ALPHA(c)
Definition: http_parser.cpp:420
CALLBACK_NOTIFY_NOADVANCE
#define CALLBACK_NOTIFY_NOADVANCE(FOR)
Definition: http_parser.cpp:102
F_CONNECTION_CLOSE
@ F_CONNECTION_CLOSE
Definition: http_parser.h:222
name
const char * name
Definition: http_parser.cpp:473
CHUNKED
#define CHUNKED
Definition: http_parser.cpp:169
s_res_H
@ s_res_H
Definition: http_parser.cpp:285
MARK
#define MARK(FOR)
Definition: http_parser.cpp:136
h_matching_transfer_encoding_token_start
@ h_matching_transfer_encoding_token_start
Definition: http_parser.cpp:384
s_http_host_start
@ s_http_host_start
Definition: http_parser.cpp:405
http_parser::header_state
unsigned int header_state
Definition: http_parser.h:301
http_should_keep_alive
int http_should_keep_alive(const http_parser *parser)
Definition: http_parser.cpp:2182
s_header_almost_done
@ s_header_almost_done
Definition: http_parser.cpp:336
s_res_status_start
@ s_res_status_start
Definition: http_parser.cpp:295
s_req_http_minor
@ s_req_http_minor
Definition: http_parser.cpp:323
s_req_http_HT
@ s_req_http_HT
Definition: http_parser.cpp:316
h_connection_keep_alive
@ h_connection_keep_alive
Definition: http_parser.cpp:395
s_chunk_parameters
@ s_chunk_parameters
Definition: http_parser.cpp:340
h_matching_connection_token
@ h_matching_connection_token
Definition: http_parser.cpp:392
h_matching_connection_upgrade
@ h_matching_connection_upgrade
Definition: http_parser.cpp:391
s_header_value_start
@ s_header_value_start
Definition: http_parser.cpp:332
http_parser_settings::on_body
http_data_cb on_body
Definition: http_parser.h:335
UF_HOST
@ UF_HOST
Definition: http_parser.h:347
LIKELY
#define LIKELY(X)
Definition: http_parser.cpp:74
http_parser_url_init
void http_parser_url_init(struct http_parser_url *u)
Definition: http_parser.cpp:2411
s_req_method
@ s_req_method
Definition: http_parser.cpp:301
IS_NUM
#define IS_NUM(c)
Definition: http_parser.cpp:421
HTTP_ERRNO_GEN
#define HTTP_ERRNO_GEN(n, s)
Definition: http_parser.h:285
s_chunk_size_almost_done
@ s_chunk_size_almost_done
Definition: http_parser.cpp:341
s_req_http_HTTP
@ s_req_http_HTTP
Definition: http_parser.cpp:318
http_parser::state
unsigned int state
Definition: http_parser.h:300
s_res_HTT
@ s_res_HTT
Definition: http_parser.cpp:287
UF_SCHEMA
@ UF_SCHEMA
Definition: http_parser.h:346
h_transfer_encoding
@ h_transfer_encoding
Definition: http_parser.cpp:381
F_UPGRADE
@ F_UPGRADE
Definition: http_parser.h:225
HTTP_STRERROR_GEN
#define HTTP_STRERROR_GEN(n, s)
Definition: http_parser.cpp:471
s_res_or_resp_H
@ s_res_or_resp_H
Definition: http_parser.cpp:283
http_cb
int(* http_cb)(http_parser *)
Definition: http_parser.h:89
HTTP_ERRNO_MAP
#define HTTP_ERRNO_MAP(XX)
Definition: http_parser.h:236
h_matching_transfer_encoding_chunked
@ h_matching_transfer_encoding_chunked
Definition: http_parser.cpp:385
IS_HOST_CHAR
#define IS_HOST_CHAR(c)
Definition: http_parser.cpp:436
s_res_HTTP
@ s_res_HTTP
Definition: http_parser.cpp:288
h_CO
@ h_CO
Definition: http_parser.cpp:368
http_errno
http_errno
Definition: http_parser.h:286
s_http_host_port
@ s_http_host_port
Definition: http_parser.cpp:413
http_data_cb
int(* http_data_cb)(http_parser *, const char *at, size_t length)
Definition: http_parser.h:88
CONNECTION
#define CONNECTION
Definition: http_parser.cpp:165
F_TRANSFER_ENCODING
@ F_TRANSFER_ENCODING
Definition: http_parser.h:228
http_errno_name
const char * http_errno_name(enum http_errno err)
Definition: http_parser.cpp:2235
http_parser_set_max_header_size
void http_parser_set_max_header_size(uint32_t size)
Definition: http_parser.cpp:2566
UF_QUERY
@ UF_QUERY
Definition: http_parser.h:350
STRICT_TOKEN
#define STRICT_TOKEN(c)
Definition: http_parser.cpp:431
s_http_userinfo
@ s_http_userinfo
Definition: http_parser.cpp:404
http_parser_url::port
uint16_t port
Definition: http_parser.h:366
http_parser_settings::on_status
http_data_cb on_status
Definition: http_parser.h:331
UNLIKELY
#define UNLIKELY(X)
Definition: http_parser.cpp:75
s_req_http_HTT
@ s_req_http_HTT
Definition: http_parser.cpp:317
http_parser_settings
Definition: http_parser.h:328
s_headers_almost_done
@ s_headers_almost_done
Definition: http_parser.cpp:343
STRICT_CHECK
#define STRICT_CHECK(cond)
Definition: http_parser.cpp:456
s_req_http_H
@ s_req_http_H
Definition: http_parser.cpp:315
http_parser_url_init
void http_parser_url_init(struct http_parser_url *u)
Definition: http_parser.cpp:2411
http_parser_pause
void http_parser_pause(http_parser *parser, int paused)
Definition: http_parser.cpp:2539
s_req_http_start
@ s_req_http_start
Definition: http_parser.cpp:314
s_header_value_discard_ws_almost_done
@ s_header_value_discard_ws_almost_done
Definition: http_parser.cpp:330
CURRENT_STATE
#define CURRENT_STATE()
Definition: http_parser.cpp:58
http_errno_description
const char * http_errno_description(enum http_errno err)
Definition: http_parser.cpp:2241
ARRAY_SIZE
#define ARRAY_SIZE(a)
Definition: http_parser.cpp:39
http_parser_settings::on_url
http_data_cb on_url
Definition: http_parser.h:330
s_message_done
@ s_message_done
Definition: http_parser.cpp:358
TOKEN
#define TOKEN(c)
Definition: http_parser.cpp:434
HTTP_PARSER_VERSION_PATCH
#define HTTP_PARSER_VERSION_PATCH
Definition: http_parser.h:30
http_parser_parse_url
int http_parser_parse_url(const char *buf, size_t buflen, int is_connect, struct http_parser_url *u)
Definition: http_parser.cpp:2416
http_parser::http_minor
unsigned short http_minor
Definition: http_parser.h:311
h_connection_upgrade
@ h_connection_upgrade
Definition: http_parser.cpp:397
s_header_value_discard_lws
@ s_header_value_discard_lws
Definition: http_parser.cpp:331
HTTP_PARSER_ERRNO
#define HTTP_PARSER_ERRNO(p)
Definition: http_parser.h:293
s_req_http_end
@ s_req_http_end
Definition: http_parser.cpp:324
s_http_userinfo_start
@ s_http_userinfo_start
Definition: http_parser.cpp:403
s_res_http_minor
@ s_res_http_minor
Definition: http_parser.cpp:291
h_CON
@ h_CON
Definition: http_parser.cpp:369
http_parser.h
UF_MAX
@ UF_MAX
Definition: http_parser.h:353
s_res_http_end
@ s_res_http_end
Definition: http_parser.cpp:292
s_dead
@ s_dead
Definition: http_parser.cpp:280
s_req_fragment
@ s_req_fragment
Definition: http_parser.cpp:313
header_states
header_states
Definition: http_parser.cpp:366
IS_USERINFO_CHAR
#define IS_USERINFO_CHAR(c)
Definition: http_parser.cpp:427
TRANSFER_ENCODING
#define TRANSFER_ENCODING
Definition: http_parser.cpp:167
http_errno_name
const char * http_errno_name(enum http_errno err)
Definition: http_parser.cpp:2235
CALLBACK_NOTIFY
#define CALLBACK_NOTIFY(FOR)
Definition: http_parser.cpp:99
s_chunk_size_start
@ s_chunk_size_start
Definition: http_parser.cpp:338
s_req_server_start
@ s_req_server_start
Definition: http_parser.cpp:306
h_matching_connection_close
@ h_matching_connection_close
Definition: http_parser.cpp:390
s_start_res
@ s_start_res
Definition: http_parser.cpp:284
s_http_host_v6_start
@ s_http_host_v6_start
Definition: http_parser.cpp:406
s_chunk_data
@ s_chunk_data
Definition: http_parser.cpp:351
LOWER
#define LOWER(c)
Definition: http_parser.cpp:419
s_req_schema_slash
@ s_req_schema_slash
Definition: http_parser.cpp:304
s_req_server
@ s_req_server
Definition: http_parser.cpp:307
s_header_field
@ s_header_field
Definition: http_parser.cpp:328
http_parser::http_major
unsigned short http_major
Definition: http_parser.h:310
s_header_value_discard_ws
@ s_header_value_discard_ws
Definition: http_parser.cpp:329
HTTP_RESPONSE
@ HTTP_RESPONSE
Definition: http_parser.h:215
HTTP_BOTH
@ HTTP_BOTH
Definition: http_parser.h:215
h_connection_close
@ h_connection_close
Definition: http_parser.cpp:396
UF_FRAGMENT
@ UF_FRAGMENT
Definition: http_parser.h:351
UPDATE_STATE
#define UPDATE_STATE(V)
Definition: http_parser.cpp:59
s_http_host
@ s_http_host
Definition: http_parser.cpp:407
s_req_server_with_at
@ s_req_server_with_at
Definition: http_parser.cpp:308
http_parser::lenient_http_headers
unsigned int lenient_http_headers
Definition: http_parser.h:304
CALLBACK_DATA_
#define CALLBACK_DATA_(FOR, LEN, ER)
Definition: http_parser.cpp:105
h_matching_upgrade
@ h_matching_upgrade
Definition: http_parser.cpp:375
s_header_value_lws
@ s_header_value_lws
Definition: http_parser.cpp:334
s_req_schema
@ s_req_schema
Definition: http_parser.cpp:303
h_matching_proxy_connection
@ h_matching_proxy_connection
Definition: http_parser.cpp:372
http_parser_url
Definition: http_parser.h:364
CR
#define CR
Definition: http_parser.cpp:417
UF_PORT
@ UF_PORT
Definition: http_parser.h:348
s_req_query_string
@ s_req_query_string
Definition: http_parser.cpp:311
http_parser::content_length
uint64_t content_length
Definition: http_parser.h:307
RETURN
#define RETURN(V)
Definition: http_parser.cpp:60
http_parser::status_code
unsigned int status_code
Definition: http_parser.h:312
s_res_http_dot
@ s_res_http_dot
Definition: http_parser.cpp:290
http_parser_settings_init
void http_parser_settings_init(http_parser_settings *settings)
Definition: http_parser.cpp:2229
HTTP_STATUS_MAP
#define HTTP_STATUS_MAP(XX)
Definition: http_parser.h:93
h_content_length_num
@ h_content_length_num
Definition: http_parser.cpp:379
KEEP_ALIVE
#define KEEP_ALIVE
Definition: http_parser.cpp:170
http_parser_settings::on_header_value
http_data_cb on_header_value
Definition: http_parser.h:333
http_parser::flags
unsigned int flags
Definition: http_parser.h:299
http_parser_url::field_data
struct http_parser_url::@1 field_data[UF_MAX]
http_parser_execute
size_t http_parser_execute(http_parser *parser, const http_parser_settings *settings, const char *data, size_t len)
Definition: http_parser.cpp:641
h_matching_content_length
@ h_matching_content_length
Definition: http_parser.cpp:373
s_http_host_v6
@ s_http_host_v6
Definition: http_parser.cpp:408
http_parser::data
void * data
Definition: http_parser.h:324
s_req_schema_slash_slash
@ s_req_schema_slash_slash
Definition: http_parser.cpp:305
h_matching_transfer_encoding_token
@ h_matching_transfer_encoding_token
Definition: http_parser.cpp:386
CALLBACK_DATA
#define CALLBACK_DATA(FOR)
Definition: http_parser.cpp:128
http_parser::upgrade
unsigned int upgrade
Definition: http_parser.h:321
UPGRADE
#define UPGRADE
Definition: http_parser.cpp:168
s_header_value
@ s_header_value
Definition: http_parser.cpp:333
http_parser_type
http_parser_type
Definition: http_parser.h:215
s_chunk_data_almost_done
@ s_chunk_data_almost_done
Definition: http_parser.cpp:352
s_http_host_v6_zone
@ s_http_host_v6_zone
Definition: http_parser.cpp:411
s_req_http_major
@ s_req_http_major
Definition: http_parser.cpp:321
s_req_fragment_start
@ s_req_fragment_start
Definition: http_parser.cpp:312
SET_ERRNO
#define SET_ERRNO(e)
Definition: http_parser.cpp:52
http_parser_url::len
uint16_t len
Definition: http_parser.h:370
T
#define T(v)
Definition: http_parser.cpp:237
h_matching_connection_keep_alive
@ h_matching_connection_keep_alive
Definition: http_parser.cpp:389
MIN
#define MIN(a, b)
Definition: http_parser.cpp:35
h_matching_connection
@ h_matching_connection
Definition: http_parser.cpp:371
s_res_http_major
@ s_res_http_major
Definition: http_parser.cpp:289
s_headers_done
@ s_headers_done
Definition: http_parser.cpp:344
s_body_identity_eof
@ s_body_identity_eof
Definition: http_parser.cpp:356
F_SKIPBODY
@ F_SKIPBODY
Definition: http_parser.h:226
F_CONNECTION_KEEP_ALIVE
@ F_CONNECTION_KEEP_ALIVE
Definition: http_parser.h:221
h_transfer_encoding_chunked
@ h_transfer_encoding_chunked
Definition: http_parser.cpp:394
ELEM_AT
#define ELEM_AT(a, i, v)
Definition: http_parser.cpp:49
HTTP_MAX_HEADER_SIZE
#define HTTP_MAX_HEADER_SIZE
Definition: http_parser.h:63
http_parser_settings_init
void http_parser_settings_init(http_parser_settings *settings)
Definition: http_parser.cpp:2229
http_parser_init
void http_parser_init(http_parser *parser, enum http_parser_type t)
Definition: http_parser.cpp:2218
HTTP_PARSER_VERSION_MINOR
#define HTTP_PARSER_VERSION_MINOR
Definition: http_parser.h:29
http_parser_settings::on_chunk_complete
http_cb on_chunk_complete
Definition: http_parser.h:341
F_CONTENTLENGTH
@ F_CONTENTLENGTH
Definition: http_parser.h:227
http_method_str
const char * http_method_str(enum http_method m)
Definition: http_parser.cpp:2201
XX
#define XX(num, name, string)
http_parser::method
unsigned int method
Definition: http_parser.h:313
http_parser_execute
size_t http_parser_execute(http_parser *parser, const http_parser_settings *settings, const char *data, size_t len)
Definition: http_parser.cpp:641
IS_HEADER_CHAR
#define IS_HEADER_CHAR(ch)
Definition: http_parser.cpp:449
state
state
Definition: http_parser.cpp:280
HTTP_REQUEST
@ HTTP_REQUEST
Definition: http_parser.h:215
http_parser::index
unsigned int index
Definition: http_parser.h:302
CLOSE
#define CLOSE
Definition: http_parser.cpp:171
http_parser::extra_flags
unsigned int extra_flags
Definition: http_parser.h:303
CALLBACK_DATA_NOADVANCE
#define CALLBACK_DATA_NOADVANCE(FOR)
Definition: http_parser.cpp:132
s_req_path
@ s_req_path
Definition: http_parser.cpp:309
HTTP_METHOD_MAP
#define HTTP_METHOD_MAP(XX)
Definition: http_parser.h:163
governikus::char
char
Definition: SmartCardDefinitions.h:17
http_parser_url::field_set
uint16_t field_set
Definition: http_parser.h:365
s_res_line_almost_done
@ s_res_line_almost_done
Definition: http_parser.cpp:297
http_parser_parse_url
int http_parser_parse_url(const char *buf, size_t buflen, int is_connect, struct http_parser_url *u)
Definition: http_parser.cpp:2416
F_CHUNKED
@ F_CHUNKED
Definition: http_parser.h:220
http_parser::type
unsigned int type
Definition: http_parser.h:298
http_body_is_final
int http_body_is_final(const http_parser *parser)
s_chunk_size
@ s_chunk_size
Definition: http_parser.cpp:339
s_res_status_code
@ s_res_status_code
Definition: http_parser.cpp:294
h_matching_connection_token_start
@ h_matching_connection_token_start
Definition: http_parser.cpp:388
REEXECUTE
#define REEXECUTE()
Definition: http_parser.cpp:66
http_parser_url_fields
http_parser_url_fields
Definition: http_parser.h:346
F_CONNECTION_UPGRADE
@ F_CONNECTION_UPGRADE
Definition: http_parser.h:223
UF_PATH
@ UF_PATH
Definition: http_parser.h:349
s_chunk_data_done
@ s_chunk_data_done
Definition: http_parser.cpp:353
s_req_line_almost_done
@ s_req_line_almost_done
Definition: http_parser.cpp:325
description
const char * description
Definition: http_parser.cpp:474
http_errno_description
const char * http_errno_description(enum http_errno err)
Definition: http_parser.cpp:2241
http_message_needs_eof
int http_message_needs_eof(const http_parser *parser)
Definition: http_parser.cpp:2153
UF_USERINFO
@ UF_USERINFO
Definition: http_parser.h:352
http_parser_init
void http_parser_init(http_parser *parser, enum http_parser_type type)
Definition: http_parser.cpp:2218
http_parser_url::off
uint16_t off
Definition: http_parser.h:369
http_parser::nread
uint32_t nread
Definition: http_parser.h:306
http_method
http_method
Definition: http_parser.h:208