diff options
Diffstat (limited to 'plugins/picohttpparser/picohttpparser.h')
| -rw-r--r-- | plugins/picohttpparser/picohttpparser.h | 31 |
1 files changed, 17 insertions, 14 deletions
diff --git a/plugins/picohttpparser/picohttpparser.h b/plugins/picohttpparser/picohttpparser.h index 8f13b36f..054c2812 100644 --- a/plugins/picohttpparser/picohttpparser.h +++ b/plugins/picohttpparser/picohttpparser.h | |||
| @@ -30,7 +30,7 @@ | |||
| 30 | #include <sys/types.h> | 30 | #include <sys/types.h> |
| 31 | 31 | ||
| 32 | #ifdef _MSC_VER | 32 | #ifdef _MSC_VER |
| 33 | #define ssize_t intptr_t | 33 | # define ssize_t intptr_t |
| 34 | #endif | 34 | #endif |
| 35 | 35 | ||
| 36 | #ifdef __cplusplus | 36 | #ifdef __cplusplus |
| @@ -40,30 +40,33 @@ extern "C" { | |||
| 40 | /* contains name and value of a header (name == NULL if is a continuing line | 40 | /* contains name and value of a header (name == NULL if is a continuing line |
| 41 | * of a multiline header */ | 41 | * of a multiline header */ |
| 42 | struct phr_header { | 42 | struct phr_header { |
| 43 | const char *name; | 43 | const char *name; |
| 44 | size_t name_len; | 44 | size_t name_len; |
| 45 | const char *value; | 45 | const char *value; |
| 46 | size_t value_len; | 46 | size_t value_len; |
| 47 | }; | 47 | }; |
| 48 | 48 | ||
| 49 | /* returns number of bytes consumed if successful, -2 if request is partial, | 49 | /* returns number of bytes consumed if successful, -2 if request is partial, |
| 50 | * -1 if failed */ | 50 | * -1 if failed */ |
| 51 | int phr_parse_request(const char *buf, size_t len, const char **method, size_t *method_len, const char **path, size_t *path_len, | 51 | int phr_parse_request(const char *buf, size_t len, const char **method, size_t *method_len, |
| 52 | int *major_version, int *minor_version, struct phr_header *headers, size_t *num_headers, size_t last_len); | 52 | const char **path, size_t *path_len, int *major_version, int *minor_version, |
| 53 | struct phr_header *headers, size_t *num_headers, size_t last_len); | ||
| 53 | 54 | ||
| 54 | /* ditto */ | 55 | /* ditto */ |
| 55 | int phr_parse_response(const char *_buf, size_t len, int *major_version, int *minor_version, int *status, const char **msg, size_t *msg_len, | 56 | int phr_parse_response(const char *_buf, size_t len, int *major_version, int *minor_version, |
| 56 | struct phr_header *headers, size_t *num_headers, size_t last_len); | 57 | int *status, const char **msg, size_t *msg_len, struct phr_header *headers, |
| 58 | size_t *num_headers, size_t last_len); | ||
| 57 | 59 | ||
| 58 | /* ditto */ | 60 | /* ditto */ |
| 59 | int phr_parse_headers(const char *buf, size_t len, struct phr_header *headers, size_t *num_headers, size_t last_len); | 61 | int phr_parse_headers(const char *buf, size_t len, struct phr_header *headers, size_t *num_headers, |
| 62 | size_t last_len); | ||
| 60 | 63 | ||
| 61 | /* should be zero-filled before start */ | 64 | /* should be zero-filled before start */ |
| 62 | struct phr_chunked_decoder { | 65 | struct phr_chunked_decoder { |
| 63 | size_t bytes_left_in_chunk; /* number of bytes left in current chunk */ | 66 | size_t bytes_left_in_chunk; /* number of bytes left in current chunk */ |
| 64 | char consume_trailer; /* if trailing headers should be consumed */ | 67 | char consume_trailer; /* if trailing headers should be consumed */ |
| 65 | char _hex_count; | 68 | char _hex_count; |
| 66 | char _state; | 69 | char _state; |
| 67 | }; | 70 | }; |
| 68 | 71 | ||
| 69 | /* the function rewrites the buffer given as (buf, bufsz) removing the chunked- | 72 | /* the function rewrites the buffer given as (buf, bufsz) removing the chunked- |
