From 9a93ca36b1551b9bfd20d2bd541f0e8059cfecad Mon Sep 17 00:00:00 2001 From: Nick Krichevsky Date: Thu, 6 Sep 2018 09:06:41 -0400 Subject: [PATCH] Remove detection of chunked encoding --- common/socket_helper.c | 8 +------- common/socket_helper.h | 3 +-- 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/common/socket_helper.c b/common/socket_helper.c index 886c8d2..03fa228 100644 --- a/common/socket_helper.c +++ b/common/socket_helper.c @@ -102,11 +102,7 @@ static struct socket_read_info get_read_info(const struct http_header *headers) const struct http_header *header_cursor = headers; struct socket_read_info info = {STRATEGY_EOF, -1}; while (header_cursor != NULL) { - if (headercmp(header_cursor, HEADER_TRANSFER_ENCODING) == 0 && - case_insensitive_strcmp(header_cursor->value, ENCODING_TYPE_CHUNKED) == 0) { - info.strategy = STRATEGY_CHUNKED; - } else if (headercmp(header_cursor, HEADER_CONTENT_LENGTH) == 0 - && info.strategy != STRATEGY_CHUNKED) { + if (headercmp(header_cursor, HEADER_CONTENT_LENGTH) == 0) { info.strategy = STRATEGY_CONTENT_LENGTH; info.length = strtol(header_cursor->value, NULL, 10); if (errno == EINVAL || errno == ERANGE) { @@ -244,8 +240,6 @@ enum socket_read_result get_all_remote_parts(int socket_fd, enum socket_type typ free(buffer); free(result); return RESULT_MALFORMED; - } else if (read_info.strategy == STRATEGY_CHUNKED) { - // TODO: Implement } else if (read_info.strategy == STRATEGY_CONTENT_LENGTH) { long net_content_length = read_info.length - (current_result_size - read_offset); // Include space for null term diff --git a/common/socket_helper.h b/common/socket_helper.h index 6e539f8..2760642 100644 --- a/common/socket_helper.h +++ b/common/socket_helper.h @@ -8,11 +8,10 @@ #define BUFFER_SIZE 1024 #define HEADER_CONTENT_LENGTH "Content-Length" #define HEADER_TRANSFER_ENCODING "Transfer-Encoding" -#define ENCODING_TYPE_CHUNKED "chunked" enum line_type {RESULT_START_LINE, RESULT_HEADER, RESULT_BLANK_LINE, RESULT_NO_LINE}; enum socket_read_result {RESULT_OK, RESULT_MALFORMED, RESULT_READ_ERROR, RESULT_PROCESSING_ERROR}; -enum socket_read_strategy {STRATEGY_CHUNKED, STRATEGY_CONTENT_LENGTH, STRATEGY_EOF, STRATEGY_UNDEFINED}; +enum socket_read_strategy {STRATEGY_CONTENT_LENGTH, STRATEGY_EOF, STRATEGY_UNDEFINED}; enum socket_type {TYPE_CLIENT, TYPE_SERVER}; struct line_read_result { enum line_type line_type;