summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorPaul Duncan <pabs@pablotron.org>2016-08-28 20:32:55 -0400
committerPaul Duncan <pabs@pablotron.org>2016-08-28 20:32:55 -0400
commit845ddb43da8aa2a8c80a9d9638d63386ddf97d7e (patch)
tree2dc0c914ac0625b8d8289d2b5d09269e6dd4ed65 /include
parent566fd0d75c4a46b8a69f67a75ecfb704e985db01 (diff)
downloadlibfhp-845ddb43da8aa2a8c80a9d9638d63386ddf97d7e.tar.bz2
libfhp-845ddb43da8aa2a8c80a9d9638d63386ddf97d7e.zip
add content-length handling and partial chunked transfer-encoding support (still need footers and compression)
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