-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathhttp_response_parser.h
43 lines (30 loc) · 1.17 KB
/
http_response_parser.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#ifndef _NGX_TCP_HTTP_RESPONSE_PARSER_H_INCLUDED_
#define _NGX_TCP_HTTP_RESPONSE_PARSER_H_INCLUDED_
#include <sys/types.h>
typedef void (*element_cb)(void *data, const signed char *at, size_t length);
typedef void (*field_cb)(void *data, const signed char *field,
size_t flen, const signed char *value, size_t vlen);
typedef struct http_response_parser {
int cs;
size_t body_start;
int content_len;
int status_code_n;
size_t nread;
size_t mark;
size_t field_start;
size_t field_len;
void *data;
field_cb http_field;
element_cb http_version;
element_cb status_code;
element_cb reason_phrase;
element_cb header_done;
} http_response_parser;
int http_response_parser_init(http_response_parser *parser);
int http_response_parser_finish(http_response_parser *parser);
size_t http_response_parser_execute(http_response_parser *parser,
const signed char *data, size_t len, size_t off);
int http_response_parser_has_error(http_response_parser *parser);
int http_response_parser_is_finished(http_response_parser *parser);
#define http_response_parser_nread(parser) (parser)->nread
#endif //_NGX_TCP_HTTP_RESPONSE_PARSER_H_INCLUDED_