class

HT2::ContentLengthValidator

Inherits Reference < Object

Validates content-length header against actual data received

Constructors

Instance methods

add_data(data : Bytes) : Nil

Add received data and validate against expected length

Source
expected_length

Get the expected content length

Source
has_content_length?

Check if content-length was specified

Source
received_length

Get the received length so far

Source
set_expected_length(headers : Array(Tuple(String, String))) : Nil

Set the expected content length from headers

Source
validate_end_of_stream

Validate that we received exactly the expected amount when stream ends

Source