Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions proxy/hdrs/HTTP.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1201,6 +1201,17 @@ validate_hdr_content_length(HdrHeap *heap, HTTPHdrImpl *hh)
int content_length_len = 0;
const char *content_length_val = content_length_field->value_get(&content_length_len);

// RFC 7230 section 3.3.2
// Content-Length = 1*DIGIT
//
// If the content-length value contains a non-numeric value, the header is invalid
for (int i = 0; i < content_length_len; i++) {
if (!isdigit(content_length_val[i])) {
Debug("http", "Content-Length value contains non-digit, returning parse error");
return PARSE_RESULT_ERROR;
}
}

while (content_length_field->has_dups()) {
int content_length_len_2 = 0;
const char *content_length_val_2 = content_length_field->m_next_dup->value_get(&content_length_len_2);
Expand Down