Remove detection of chunked encoding

This commit is contained in:
Nick Krichevsky 2018-09-06 09:06:41 -04:00
parent d650fc413c
commit 9a93ca36b1
2 changed files with 2 additions and 9 deletions

View file

@ -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

View file

@ -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;