From 4d9af2534e3424357276028b1fa82eb49c2dfd99 Mon Sep 17 00:00:00 2001 From: Paul Duncan Date: Sun, 28 Aug 2016 03:45:48 -0400 Subject: remove fhp_handle_header_name() (move to header-value-parser.c --- fhp.c | 50 -------------------------------------------------- 1 file changed, 50 deletions(-) (limited to 'fhp.c') diff --git a/fhp.c b/fhp.c index f8263c2..1eceeee 100644 --- a/fhp.c +++ b/fhp.c @@ -115,51 +115,6 @@ fhp_handle_method(fhp_t * const fhp) { return FHP_OK; } -// FIXME: follow RFC7230 3.3.3 -// https://tools.ietf.org/html/rfc7230#section-3.3.3 -static fhp_err_t -fhp_handle_header_name(fhp_t * const fhp) { - uint32_t hash = fhp->header_name_hash; - - if (hash == fhp->env->hashes[FHP_STR_CONTENT_LENGTH]) { - switch (fhp->body_type) { - case FHP_BODY_TYPE_CONTENT_LENGTH: - // duplicate content-length, ignore first one - // FIXME: should print warning here - case FHP_BODY_TYPE_NONE: - fhp->body_type = FHP_BODY_TYPE_CONTENT_LENGTH; - break; - case FHP_BODY_TYPE_TRANSFER_ENCODING: - // ignore content-length - // FIXME: should print warnings - break; - default: - // never reached - return FHP_ERR_INVALID_BODY_TYPE; - } - } else if (hash == fhp->env->hashes[FHP_STR_TRANSFER_ENCODING]) { - switch (fhp->body_type) { - case FHP_BODY_TYPE_CONTENT_LENGTH: - // duplicate content-length, ignore first one - // FIXME: should print warning here - case FHP_BODY_TYPE_NONE: - fhp->body_type = FHP_BODY_TYPE_TRANSFER_ENCODING; - break; - case FHP_BODY_TYPE_TRANSFER_ENCODING: - // ignore content-length - // FIXME: should print warnings - break; - default: - // never reached - return FHP_ERR_INVALID_BODY_TYPE; - } - } - - // return success - return FHP_OK; -} - - static fhp_err_t fhp_push_byte( fhp_t * const fhp, @@ -455,11 +410,6 @@ retry: fhp->is_hashing = false; fhp->header_name_hash = fhp->buf_hash; - // handle header name - fhp_err_t err = fhp_handle_header_name(fhp); - if (err != FHP_OK) - return err; - // send end token if (!fhp->cb(fhp, FHP_TOKEN_HEADER_NAME_END, 0, 0)) return FHP_ERR_CB; -- cgit v1.2.3