fix problem when finishing a chunked encoding stream
[m6w6/ext-http] / php_http_header_parser.h
1 #ifndef PHP_HTTP_HEADER_PARSER_H
2 #define PHP_HTTP_HEADER_PARSER_H
3
4 typedef enum php_http_header_parser_state {
5 PHP_HTTP_HEADER_PARSER_STATE_FAILURE = FAILURE,
6 PHP_HTTP_HEADER_PARSER_STATE_START = 0,
7 PHP_HTTP_HEADER_PARSER_STATE_KEY,
8 PHP_HTTP_HEADER_PARSER_STATE_VALUE,
9 PHP_HTTP_HEADER_PARSER_STATE_HEADER_DONE,
10 PHP_HTTP_HEADER_PARSER_STATE_DONE
11 } php_http_header_parser_state_t;
12
13 #define PHP_HTTP_HEADER_PARSER_CLEANUP 0x1
14
15 typedef struct php_http_header_parser {
16 zend_stack stack;
17 php_http_info_t info;
18 struct {
19 char *str;
20 size_t len;
21 } _key;
22 struct {
23 char *str;
24 size_t len;
25 } _val;
26 #ifdef ZTS
27 void ***ts;
28 #endif
29 } php_http_header_parser_t;
30
31 PHP_HTTP_API php_http_header_parser_t *php_http_header_parser_init(php_http_header_parser_t *parser TSRMLS_DC);
32 PHP_HTTP_API php_http_header_parser_state_t php_http_header_parser_state_push(php_http_header_parser_t *parser, unsigned argc, ...);
33 PHP_HTTP_API php_http_header_parser_state_t php_http_header_parser_state_is(php_http_header_parser_t *parser);
34 PHP_HTTP_API php_http_header_parser_state_t php_http_header_parser_state_pop(php_http_header_parser_t *parser);
35 PHP_HTTP_API void php_http_header_parser_dtor(php_http_header_parser_t *parser);
36 PHP_HTTP_API void php_http_header_parser_free(php_http_header_parser_t **parser);
37 PHP_HTTP_API STATUS php_http_header_parser_parse(php_http_header_parser_t *parser, php_http_buffer *buffer, unsigned flags, HashTable *headers, php_http_info_callback_t callback_func, void *callback_arg);
38
39 #endif /* PHP_HTTP_HEADER_PARSER_H */