summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ctx.c72
1 files changed, 40 insertions, 32 deletions
diff --git a/ctx.c b/ctx.c
index e73fba8..3f2f98f 100644
--- a/ctx.c
+++ b/ctx.c
@@ -1,40 +1,9 @@
#include "internal.h"
//
-// context functions
+// context buffer functions
//
-static const fhp_ctx_t FHP_DEFAULT_CONTEXT = {
- .state = FHP_STATE_INIT,
- .user_data = NULL,
- .cb = NULL,
- .err = FHP_OK,
- .ofs = 0,
- .buf_len = 0,
- .is_hashing = false,
- .header_name_hash = 0,
- .header_value_parser = FHP_HEADER_VALUE_PARSER_NONE,
- .body_type = FHP_BODY_TYPE_NONE,
- .content_length = 0,
- .num_tes = 0,
-};
-
-fhp_err_t
-fhp_ctx_init(
- fhp_ctx_t * const ctx,
- fhp_env_t * const env,
- fhp_cb_t cb,
- void * const user_data
-) {
- *ctx = FHP_DEFAULT_CONTEXT;
- ctx->env = env ? env : fhp_get_default_env();
- ctx->user_data = user_data;
- ctx->cb = cb;
-
- /* return success */
- return FHP_OK;
-}
-
static void
fhp_ctx_buf_clear(fhp_ctx_t * const ctx) {
// clear buffer
@@ -89,6 +58,10 @@ fhp_ctx_buf_push(
return FHP_OK;
}
+//
+// method functions
+//
+
static fhp_err_t
fhp_ctx_handle_method(fhp_ctx_t * const ctx) {
// get method token
@@ -115,6 +88,41 @@ fhp_ctx_handle_method(fhp_ctx_t * const ctx) {
return FHP_OK;
}
+//
+// context functions
+//
+
+static const fhp_ctx_t FHP_DEFAULT_CONTEXT = {
+ .state = FHP_STATE_INIT,
+ .user_data = NULL,
+ .cb = NULL,
+ .err = FHP_OK,
+ .ofs = 0,
+ .buf_len = 0,
+ .is_hashing = false,
+ .header_name_hash = 0,
+ .header_value_parser = FHP_HEADER_VALUE_PARSER_NONE,
+ .body_type = FHP_BODY_TYPE_NONE,
+ .content_length = 0,
+ .num_tes = 0,
+};
+
+fhp_err_t
+fhp_ctx_init(
+ fhp_ctx_t * const ctx,
+ fhp_env_t * const env,
+ fhp_cb_t cb,
+ void * const user_data
+) {
+ *ctx = FHP_DEFAULT_CONTEXT;
+ ctx->env = env ? env : fhp_get_default_env();
+ ctx->user_data = user_data;
+ ctx->cb = cb;
+
+ /* return success */
+ return FHP_OK;
+}
+
static fhp_err_t
fhp_ctx_push_byte(
fhp_ctx_t * const ctx,