summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/fhp/fhp.h31
1 files changed, 31 insertions, 0 deletions
diff --git a/include/fhp/fhp.h b/include/fhp/fhp.h
index 639eb0f..3aa020d 100644
--- a/include/fhp/fhp.h
+++ b/include/fhp/fhp.h
@@ -47,6 +47,10 @@ typedef enum {
FHP_ERR_CL_PARSER_DONE,
FHP_ERR_BAD_CL_STATE,
FHP_ERR_CL_OVERFLOW,
+ FHP_ERR_INVALID_CHAR_IN_CHUNK_LEN,
+ FHP_ERR_INVALID_CHAR_AFTER_CHUNK_LEN,
+ FHP_ERR_CHUNK_LEN_OVERFLOW,
+ FHP_ERR_INVALID_CHAR_AFTER_CHUNK_BODY,
FHP_ERR_LAST
} fhp_err_t;
@@ -93,6 +97,19 @@ typedef enum {
FHP_TOKEN_HEADER_TRANSFER_ENCODING,
FHP_TOKEN_HEADER_CONTENT_LENGTH,
+ FHP_TOKEN_HEADERS_END,
+
+ FHP_TOKEN_BODY_NONE,
+ FHP_TOKEN_BODY_START,
+ FHP_TOKEN_BODY_FRAGMENT,
+ FHP_TOKEN_BODY_END,
+
+ FHP_TOKEN_CHUNK_START,
+ FHP_TOKEN_CHUNK_END,
+ FHP_TOKEN_CHUNK_LAST,
+
+ FHP_TOKEN_REQUEST_END,
+
FHP_TOKEN_LAST
} fhp_token_t;
@@ -225,6 +242,14 @@ typedef enum {
FHP_STATE_HEADER_VALUE_END,
FHP_STATE_HEADERS_END,
FHP_STATE_HEADERS_END_CR,
+ FHP_STATE_CL_BODY,
+ FHP_STATE_CHUNK_LEN,
+ FHP_STATE_CHUNK_LEN_CR,
+ FHP_STATE_CHUNK_BODY,
+ FHP_STATE_CHUNK_BODY_END,
+ FHP_STATE_CHUNK_BODY_END_CR,
+ FHP_STATE_TE_FOOTER,
+ FHP_STATE_REQUEST_END,
FHP_STATE_LAST
} fhp_state_t;
@@ -291,6 +316,12 @@ struct fhp_ctx_t_ {
// state for url hex decoder
uint32_t hex;
+
+ // state for chunk length decoder
+ uint64_t chunk_len;
+
+ // bytes remaining for body (content-length) or current chunk (chunked)
+ uint64_t bytes_left;
};
fhp_err_t