MCPcopy Create free account
hub / github.com/apache/trafficserver / payload_length_is_valid

Method payload_length_is_valid

include/proxy/http2/Http2Stream.h:393–412  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

391}
392
393inline bool
394Http2Stream::payload_length_is_valid() const
395{
396 uint32_t content_length = _receive_header.get_content_length();
397 uint64_t mask = (MIME_PRESENCE_IF_UNMODIFIED_SINCE | MIME_PRESENCE_IF_MODIFIED_SINCE | MIME_PRESENCE_IF_RANGE |
398 MIME_PRESENCE_IF_MATCH | MIME_PRESENCE_IF_NONE_MATCH);
399
400 // Skip Content-Length check on [RFC 7230] 3.3.2 conditions
401 bool is_payload_precluded =
402 this->is_outbound_connection() && (_send_header.method_get_wksidx() == HTTP_WKSIDX_HEAD ||
403 (_send_header.method_get_wksidx() == HTTP_WKSIDX_GET && _send_header.presence(mask) &&
404 _receive_header.status_get() == HTTP_STATUS_NOT_MODIFIED));
405
406 if (content_length != 0 && !is_payload_precluded && content_length != data_length) {
407 Warning("Bad payload length content_length=%d data_legnth=%d session_id=%" PRId64, content_length,
408 static_cast<int>(data_length), _proxy_ssn->connection_id());
409 return false;
410 }
411 return true;
412}
413
414inline bool
415Http2Stream::is_state_writeable() const

Callers 3

rcv_data_frameMethod · 0.80
rcv_headers_frameMethod · 0.80

Calls 6

get_content_lengthMethod · 0.80
method_get_wksidxMethod · 0.80
presenceMethod · 0.80
status_getMethod · 0.45
connection_idMethod · 0.45

Tested by

no test coverage detected