Skip to content
Open
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
14 changes: 12 additions & 2 deletions include/proxy/http2/Http2Stream.h
Original file line number Diff line number Diff line change
Expand Up @@ -390,11 +390,21 @@ inline bool
Http2Stream::payload_length_is_valid() const
{
uint32_t content_length = _receive_header.get_content_length();
if (content_length != 0 && content_length != data_length) {
uint64_t mask = (MIME_PRESENCE_IF_UNMODIFIED_SINCE | MIME_PRESENCE_IF_MODIFIED_SINCE | MIME_PRESENCE_IF_RANGE |
MIME_PRESENCE_IF_MATCH | MIME_PRESENCE_IF_NONE_MATCH);

// Skip Content-Length check on [RFC 7230] 3.3.2 conditions
bool is_payload_precluded =
this->is_outbound_connection() && (_send_header.method_get_wksidx() == HTTP_WKSIDX_HEAD ||
(_send_header.method_get_wksidx() == HTTP_WKSIDX_GET && _send_header.presence(mask) &&
_receive_header.status_get() == HTTPStatus::NOT_MODIFIED));

if (content_length != 0 && !is_payload_precluded && content_length != data_length) {
Warning("Bad payload length content_length=%d data_legnth=%d session_id=%" PRId64, content_length,
static_cast<int>(data_length), _proxy_ssn->connection_id());
return false;
}
return content_length == 0 || content_length == data_length;
return true;
}

inline bool
Expand Down