code
stringlengths
66
870k
docstring
stringlengths
19
26.7k
func_name
stringlengths
1
138
language
stringclasses
1 value
repo
stringlengths
7
68
path
stringlengths
5
324
url
stringlengths
46
389
license
stringclasses
7 values
def open(self) -> bool: """ Whether the stream is 'open' in any sense: that is, whether it counts against the number of concurrent streams. """ # RFC 7540 Section 5.1.2 defines 'open' for this purpose to mean either # the OPEN state or either of the HALF_CLOSED states. Pe...
Whether the stream is 'open' in any sense: that is, whether it counts against the number of concurrent streams.
open
python
python-hyper/h2
src/h2/stream.py
https://github.com/python-hyper/h2/blob/master/src/h2/stream.py
MIT
def upgrade(self, client_side: bool) -> None: """ Called by the connection to indicate that this stream is the initial request/response of an upgraded connection. Places the stream into an appropriate state. """ self.config.logger.debug("Upgrading %r", self) asse...
Called by the connection to indicate that this stream is the initial request/response of an upgraded connection. Places the stream into an appropriate state.
upgrade
python
python-hyper/h2
src/h2/stream.py
https://github.com/python-hyper/h2/blob/master/src/h2/stream.py
MIT
def locally_pushed(self) -> list[Frame]: """ Mark this stream as one that was pushed by this peer. Must be called immediately after initialization. Sends no frames, simply updates the state machine. """ # This does not trigger any events. events = self.state_machi...
Mark this stream as one that was pushed by this peer. Must be called immediately after initialization. Sends no frames, simply updates the state machine.
locally_pushed
python
python-hyper/h2
src/h2/stream.py
https://github.com/python-hyper/h2/blob/master/src/h2/stream.py
MIT
def send_data(self, data: bytes | memoryview, end_stream: bool = False, pad_length: int | None = None) -> list[Frame]: """ Prepare some data frames. Optionally end the stream. .. warning:: Does not perform flow control checks. """ ...
Prepare some data frames. Optionally end the stream. .. warning:: Does not perform flow control checks.
send_data
python
python-hyper/h2
src/h2/stream.py
https://github.com/python-hyper/h2/blob/master/src/h2/stream.py
MIT
def advertise_alternative_service(self, field_value: bytes) -> list[Frame]: """ Advertise an RFC 7838 alternative service. The semantics of this are better documented in the ``H2Connection`` class. """ self.config.logger.debug( "Advertise alternative service of %r for...
Advertise an RFC 7838 alternative service. The semantics of this are better documented in the ``H2Connection`` class.
advertise_alternative_service
python
python-hyper/h2
src/h2/stream.py
https://github.com/python-hyper/h2/blob/master/src/h2/stream.py
MIT
def increase_flow_control_window(self, increment: int) -> list[Frame]: """ Increase the size of the flow control window for the remote side. """ self.config.logger.debug( "Increase flow control window for %r by %d", self, increment, ) self.state_ma...
Increase the size of the flow control window for the remote side.
increase_flow_control_window
python
python-hyper/h2
src/h2/stream.py
https://github.com/python-hyper/h2/blob/master/src/h2/stream.py
MIT
def receive_push_promise_in_band(self, promised_stream_id: int, headers: Iterable[Header], header_encoding: bool | str | None) -> tuple[list[Frame], list[Event]]: """ Receives a push promise fr...
Receives a push promise frame sent on this stream, pushing a remote stream. This is called on the stream that has the PUSH_PROMISE sent on it.
receive_push_promise_in_band
python
python-hyper/h2
src/h2/stream.py
https://github.com/python-hyper/h2/blob/master/src/h2/stream.py
MIT
def remotely_pushed(self, pushed_headers: Iterable[Header]) -> tuple[list[Frame], list[Event]]: """ Mark this stream as one that was pushed by the remote peer. Must be called immediately after initialization. Sends no frames, simply updates the state machine. """ self.con...
Mark this stream as one that was pushed by the remote peer. Must be called immediately after initialization. Sends no frames, simply updates the state machine.
remotely_pushed
python
python-hyper/h2
src/h2/stream.py
https://github.com/python-hyper/h2/blob/master/src/h2/stream.py
MIT
def receive_headers(self, headers: Iterable[Header], end_stream: bool, header_encoding: bool | str | None) -> tuple[list[Frame], list[Event]]: """ Receive a set of headers (or trailers). """ if is_informational_respo...
Receive a set of headers (or trailers).
receive_headers
python
python-hyper/h2
src/h2/stream.py
https://github.com/python-hyper/h2/blob/master/src/h2/stream.py
MIT
def receive_continuation(self) -> None: """ A naked CONTINUATION frame has been received. This is always an error, but the type of error it is depends on the state of the stream and must transition the state of the stream, so we need to handle it. """ self.config.logger.d...
A naked CONTINUATION frame has been received. This is always an error, but the type of error it is depends on the state of the stream and must transition the state of the stream, so we need to handle it.
receive_continuation
python
python-hyper/h2
src/h2/stream.py
https://github.com/python-hyper/h2/blob/master/src/h2/stream.py
MIT
def receive_alt_svc(self, frame: AltSvcFrame) -> tuple[list[Frame], list[Event]]: """ An Alternative Service frame was received on the stream. This frame inherits the origin associated with this stream. """ self.config.logger.debug( "Receive Alternative Service frame ...
An Alternative Service frame was received on the stream. This frame inherits the origin associated with this stream.
receive_alt_svc
python
python-hyper/h2
src/h2/stream.py
https://github.com/python-hyper/h2/blob/master/src/h2/stream.py
MIT
def reset_stream(self, error_code: ErrorCodes | int = 0) -> list[Frame]: """ Close the stream locally. Reset the stream with an error code. """ self.config.logger.debug( "Local reset %r with error code: %d", self, error_code, ) self.state_machine.process_input...
Close the stream locally. Reset the stream with an error code.
reset_stream
python
python-hyper/h2
src/h2/stream.py
https://github.com/python-hyper/h2/blob/master/src/h2/stream.py
MIT
def acknowledge_received_data(self, acknowledged_size: int) -> list[Frame]: """ The user has informed us that they've processed some amount of data that was received on this stream. Pass that to the window manager and potentially return some WindowUpdate frames. """ self....
The user has informed us that they've processed some amount of data that was received on this stream. Pass that to the window manager and potentially return some WindowUpdate frames.
acknowledge_received_data
python
python-hyper/h2
src/h2/stream.py
https://github.com/python-hyper/h2/blob/master/src/h2/stream.py
MIT
def _build_hdr_validation_flags(self, events: Any) -> HeaderValidationFlags: """ Constructs a set of header validation flags for use when normalizing and validating header blocks. """ is_trailer = isinstance( events[0], (_TrailersSent, TrailersReceived), ) ...
Constructs a set of header validation flags for use when normalizing and validating header blocks.
_build_hdr_validation_flags
python
python-hyper/h2
src/h2/stream.py
https://github.com/python-hyper/h2/blob/master/src/h2/stream.py
MIT
def _build_headers_frames(self, headers: Iterable[Header], encoder: Encoder, first_frame: HeadersFrame | PushPromiseFrame, hdr_validation_flags: HeaderValidationFlags) \ -> list[HeadersFra...
Helper method to build headers or push promise frames.
_build_headers_frames
python
python-hyper/h2
src/h2/stream.py
https://github.com/python-hyper/h2/blob/master/src/h2/stream.py
MIT
def _process_received_headers(self, headers: Iterable[Header], header_validation_flags: HeaderValidationFlags, header_encoding: bool | str | None) -> list[Header]: """ When headers have been received fr...
When headers have been received from the remote peer, run a processing pipeline on them to transform them into the appropriate form for attaching to an event.
_process_received_headers
python
python-hyper/h2
src/h2/stream.py
https://github.com/python-hyper/h2/blob/master/src/h2/stream.py
MIT
def _initialize_content_length(self, headers: Iterable[Header]) -> None: """ Checks the headers for a content-length header and initializes the _expected_content_length field from it. It's not an error for no Content-Length header to be present. """ if self.request_method...
Checks the headers for a content-length header and initializes the _expected_content_length field from it. It's not an error for no Content-Length header to be present.
_initialize_content_length
python
python-hyper/h2
src/h2/stream.py
https://github.com/python-hyper/h2/blob/master/src/h2/stream.py
MIT
def _track_content_length(self, length: int, end_stream: bool) -> None: """ Update the expected content length in response to data being received. Validates that the appropriate amount of data is sent. Always updates the received data, but only validates the length against the co...
Update the expected content length in response to data being received. Validates that the appropriate amount of data is sent. Always updates the received data, but only validates the length against the content-length header if one was sent. :param length: The length of the body...
_track_content_length
python
python-hyper/h2
src/h2/stream.py
https://github.com/python-hyper/h2/blob/master/src/h2/stream.py
MIT
def _inbound_flow_control_change_from_settings(self, delta: int) -> None: """ We changed SETTINGS_INITIAL_WINDOW_SIZE, which means we need to update the target window size for flow control. For our flow control strategy, this means we need to do two things: we need to adjust the ...
We changed SETTINGS_INITIAL_WINDOW_SIZE, which means we need to update the target window size for flow control. For our flow control strategy, this means we need to do two things: we need to adjust the current window size, but we also need to set the target maximum window size t...
_inbound_flow_control_change_from_settings
python
python-hyper/h2
src/h2/stream.py
https://github.com/python-hyper/h2/blob/master/src/h2/stream.py
MIT
def _decode_headers(headers: Iterable[HeaderWeaklyTyped], encoding: str) -> Generator[HeaderTuple, None, None]: """ Given an iterable of header two-tuples and an encoding, decodes those headers using that encoding while preserving the type of the header tuple. This ensures that the use of ``HeaderTuple`...
Given an iterable of header two-tuples and an encoding, decodes those headers using that encoding while preserving the type of the header tuple. This ensures that the use of ``HeaderTuple`` is preserved.
_decode_headers
python
python-hyper/h2
src/h2/stream.py
https://github.com/python-hyper/h2/blob/master/src/h2/stream.py
MIT
def _secure_headers(headers: Iterable[Header], hdr_validation_flags: HeaderValidationFlags | None) -> Generator[Header, None, None]: """ Certain headers are at risk of being attacked during the header compression phase, and so need to be kept out of header compression contexts. This ...
Certain headers are at risk of being attacked during the header compression phase, and so need to be kept out of header compression contexts. This function automatically transforms certain specific headers into HPACK never-indexed fields to ensure they don't get added to header compression contexts...
_secure_headers
python
python-hyper/h2
src/h2/utilities.py
https://github.com/python-hyper/h2/blob/master/src/h2/utilities.py
MIT
def extract_method_header(headers: Iterable[Header]) -> bytes | None: """ Extracts the request method from the headers list. """ for k, v in headers: if isinstance(v, bytes) and k == b":method": return v if isinstance(v, str) and k == ":method": return v.encode("u...
Extracts the request method from the headers list.
extract_method_header
python
python-hyper/h2
src/h2/utilities.py
https://github.com/python-hyper/h2/blob/master/src/h2/utilities.py
MIT
def is_informational_response(headers: Iterable[Header]) -> bool: """ Searches headers list for a :status header to confirm that a given collection of headers are an informational response. Assumes the header are well formed and encoded as bytes: that is, that the HTTP/2 special headers are first in...
Searches headers list for a :status header to confirm that a given collection of headers are an informational response. Assumes the header are well formed and encoded as bytes: that is, that the HTTP/2 special headers are first in the block, and so that it can stop looking when it finds the first h...
is_informational_response
python
python-hyper/h2
src/h2/utilities.py
https://github.com/python-hyper/h2/blob/master/src/h2/utilities.py
MIT
def guard_increment_window(current: int, increment: int) -> int: """ Increments a flow control window, guarding against that window becoming too large. :param current: The current value of the flow control window. :param increment: The increment to apply to that window. :returns: The new value ...
Increments a flow control window, guarding against that window becoming too large. :param current: The current value of the flow control window. :param increment: The increment to apply to that window. :returns: The new value of the window. :raises: ``FlowControlError``
guard_increment_window
python
python-hyper/h2
src/h2/utilities.py
https://github.com/python-hyper/h2/blob/master/src/h2/utilities.py
MIT
def authority_from_headers(headers: Iterable[Header]) -> bytes | None: """ Given a header set, searches for the authority header and returns the value. Note that this doesn't use indexing, so should only be called if the headers are for a client request. Otherwise, will loop over the entire hea...
Given a header set, searches for the authority header and returns the value. Note that this doesn't use indexing, so should only be called if the headers are for a client request. Otherwise, will loop over the entire header set, which is potentially unwise. :param headers: The HTTP header set...
authority_from_headers
python
python-hyper/h2
src/h2/utilities.py
https://github.com/python-hyper/h2/blob/master/src/h2/utilities.py
MIT
def validate_headers(headers: Iterable[Header], hdr_validation_flags: HeaderValidationFlags) -> Iterable[Header]: """ Validates a header sequence against a set of constraints from RFC 7540. :param headers: The HTTP header set. :param hdr_validation_flags: An instance of HeaderValidationFlags. """ ...
Validates a header sequence against a set of constraints from RFC 7540. :param headers: The HTTP header set. :param hdr_validation_flags: An instance of HeaderValidationFlags.
validate_headers
python
python-hyper/h2
src/h2/utilities.py
https://github.com/python-hyper/h2/blob/master/src/h2/utilities.py
MIT
def _reject_empty_header_names(headers: Iterable[Header], hdr_validation_flags: HeaderValidationFlags) -> Generator[Header, None, None]: """ Raises a ProtocolError if any header names are empty (length 0). While hpack decodes such headers without errors, they are semantically ...
Raises a ProtocolError if any header names are empty (length 0). While hpack decodes such headers without errors, they are semantically forbidden in HTTP, see RFC 7230, stating that they must be at least one character long.
_reject_empty_header_names
python
python-hyper/h2
src/h2/utilities.py
https://github.com/python-hyper/h2/blob/master/src/h2/utilities.py
MIT
def _reject_uppercase_header_fields(headers: Iterable[Header], hdr_validation_flags: HeaderValidationFlags) -> Generator[Header, None, None]: """ Raises a ProtocolError if any uppercase character is found in a header block. """ for header in headers: if UP...
Raises a ProtocolError if any uppercase character is found in a header block.
_reject_uppercase_header_fields
python
python-hyper/h2
src/h2/utilities.py
https://github.com/python-hyper/h2/blob/master/src/h2/utilities.py
MIT
def _reject_surrounding_whitespace(headers: Iterable[Header], hdr_validation_flags: HeaderValidationFlags) -> Generator[Header, None, None]: """ Raises a ProtocolError if any header name or value is surrounded by whitespace characters. """ # For compatibility with ...
Raises a ProtocolError if any header name or value is surrounded by whitespace characters.
_reject_surrounding_whitespace
python
python-hyper/h2
src/h2/utilities.py
https://github.com/python-hyper/h2/blob/master/src/h2/utilities.py
MIT
def _reject_te(headers: Iterable[Header], hdr_validation_flags: HeaderValidationFlags) -> Generator[Header, None, None]: """ Raises a ProtocolError if the TE header is present in a header block and its value is anything other than "trailers". """ for header in headers: if header[0] == b"te" ...
Raises a ProtocolError if the TE header is present in a header block and its value is anything other than "trailers".
_reject_te
python
python-hyper/h2
src/h2/utilities.py
https://github.com/python-hyper/h2/blob/master/src/h2/utilities.py
MIT
def _reject_connection_header(headers: Iterable[Header], hdr_validation_flags: HeaderValidationFlags) -> Generator[Header, None, None]: """ Raises a ProtocolError if the Connection header is present in a header block. """ for header in headers: if header[0] in CONNECTION_HEADERS: ...
Raises a ProtocolError if the Connection header is present in a header block.
_reject_connection_header
python
python-hyper/h2
src/h2/utilities.py
https://github.com/python-hyper/h2/blob/master/src/h2/utilities.py
MIT
def _assert_header_in_set(bytes_header: bytes, header_set: set[bytes | str] | set[bytes] | set[str]) -> None: """ Given a set of header names, checks whether the string or byte version of the header name is present. Raises a Protocol error with the appropriate error if it's mis...
Given a set of header names, checks whether the string or byte version of the header name is present. Raises a Protocol error with the appropriate error if it's missing.
_assert_header_in_set
python
python-hyper/h2
src/h2/utilities.py
https://github.com/python-hyper/h2/blob/master/src/h2/utilities.py
MIT
def _reject_pseudo_header_fields(headers: Iterable[Header], hdr_validation_flags: HeaderValidationFlags) -> Generator[Header, None, None]: """ Raises a ProtocolError if duplicate pseudo-header fields are found in a header block or if a pseudo-header field appears in a block ...
Raises a ProtocolError if duplicate pseudo-header fields are found in a header block or if a pseudo-header field appears in a block after an ordinary header field. Raises a ProtocolError if pseudo-header fields are found in trailers.
_reject_pseudo_header_fields
python
python-hyper/h2
src/h2/utilities.py
https://github.com/python-hyper/h2/blob/master/src/h2/utilities.py
MIT
def _validate_host_authority_header(headers: Iterable[Header]) -> Generator[Header, None, None]: """ Given the :authority and Host headers from a request block that isn't a trailer, check that: 1. At least one of these headers is set. 2. If both headers are set, they match. :param headers: Th...
Given the :authority and Host headers from a request block that isn't a trailer, check that: 1. At least one of these headers is set. 2. If both headers are set, they match. :param headers: The HTTP header set. :raises: ``ProtocolError``
_validate_host_authority_header
python
python-hyper/h2
src/h2/utilities.py
https://github.com/python-hyper/h2/blob/master/src/h2/utilities.py
MIT
def _check_host_authority_header(headers: Iterable[Header], hdr_validation_flags: HeaderValidationFlags) -> Generator[Header, None, None]: """ Raises a ProtocolError if a header block arrives that does not contain an :authority or a Host header, or if a header block contains...
Raises a ProtocolError if a header block arrives that does not contain an :authority or a Host header, or if a header block contains both fields, but their values do not match.
_check_host_authority_header
python
python-hyper/h2
src/h2/utilities.py
https://github.com/python-hyper/h2/blob/master/src/h2/utilities.py
MIT
def _check_path_header(headers: Iterable[Header], hdr_validation_flags: HeaderValidationFlags) -> Generator[Header, None, None]: """ Raise a ProtocolError if a header block arrives or is sent that contains an empty :path header. """ def inner() -> Generator[Header, None, None]...
Raise a ProtocolError if a header block arrives or is sent that contains an empty :path header.
_check_path_header
python
python-hyper/h2
src/h2/utilities.py
https://github.com/python-hyper/h2/blob/master/src/h2/utilities.py
MIT
def utf8_encode_headers(headers: Iterable[HeaderWeaklyTyped]) -> list[Header]: """ Given an iterable of header two-tuples, rebuilds that as a list with the header names and values encoded as utf-8 bytes. This function produces tuples that preserve the original type of the header tuple for tuple and ...
Given an iterable of header two-tuples, rebuilds that as a list with the header names and values encoded as utf-8 bytes. This function produces tuples that preserve the original type of the header tuple for tuple and any ``HeaderTuple``.
utf8_encode_headers
python
python-hyper/h2
src/h2/utilities.py
https://github.com/python-hyper/h2/blob/master/src/h2/utilities.py
MIT
def _lowercase_header_names(headers: Iterable[Header], hdr_validation_flags: HeaderValidationFlags | None) -> Generator[Header, None, None]: """ Given an iterable of header two-tuples, rebuilds that iterable with the header names lowercased. This generator produces tuples that pr...
Given an iterable of header two-tuples, rebuilds that iterable with the header names lowercased. This generator produces tuples that preserve the original type of the header tuple for tuple and any ``HeaderTuple``.
_lowercase_header_names
python
python-hyper/h2
src/h2/utilities.py
https://github.com/python-hyper/h2/blob/master/src/h2/utilities.py
MIT
def _strip_surrounding_whitespace(headers: Iterable[Header], hdr_validation_flags: HeaderValidationFlags | None) -> Generator[Header, None, None]: """ Given an iterable of header two-tuples, strip both leading and trailing whitespace from both header names and header values...
Given an iterable of header two-tuples, strip both leading and trailing whitespace from both header names and header values. This generator produces tuples that preserve the original type of the header tuple for tuple and any ``HeaderTuple``.
_strip_surrounding_whitespace
python
python-hyper/h2
src/h2/utilities.py
https://github.com/python-hyper/h2/blob/master/src/h2/utilities.py
MIT
def _check_sent_host_authority_header(headers: Iterable[Header], hdr_validation_flags: HeaderValidationFlags) -> Generator[Header, None, None]: """ Raises an InvalidHeaderBlockError if we try to send a header block that does not contain an :authority or a Host header, o...
Raises an InvalidHeaderBlockError if we try to send a header block that does not contain an :authority or a Host header, or if the header block contains both fields, but their values do not match.
_check_sent_host_authority_header
python
python-hyper/h2
src/h2/utilities.py
https://github.com/python-hyper/h2/blob/master/src/h2/utilities.py
MIT
def normalize_outbound_headers(headers: Iterable[Header], hdr_validation_flags: HeaderValidationFlags | None, should_split_outbound_cookies: bool=False) -> Generator[Header, None, None]: """ Normalizes a header sequence that we are about to send. ...
Normalizes a header sequence that we are about to send. :param headers: The HTTP header set. :param hdr_validation_flags: An instance of HeaderValidationFlags. :param should_split_outbound_cookies: boolean flag
normalize_outbound_headers
python
python-hyper/h2
src/h2/utilities.py
https://github.com/python-hyper/h2/blob/master/src/h2/utilities.py
MIT
def normalize_inbound_headers(headers: Iterable[Header], hdr_validation_flags: HeaderValidationFlags) -> Generator[Header, None, None]: """ Normalizes a header sequence that we have received. :param headers: The HTTP header set. :param hdr_validation_flags: An instance of ...
Normalizes a header sequence that we have received. :param headers: The HTTP header set. :param hdr_validation_flags: An instance of HeaderValidationFlags
normalize_inbound_headers
python
python-hyper/h2
src/h2/utilities.py
https://github.com/python-hyper/h2/blob/master/src/h2/utilities.py
MIT
def validate_outbound_headers(headers: Iterable[Header], hdr_validation_flags: HeaderValidationFlags) -> Generator[Header, None, None]: """ Validates and normalizes a header sequence that we are about to send. :param headers: The HTTP header set. :param hdr_validation_flag...
Validates and normalizes a header sequence that we are about to send. :param headers: The HTTP header set. :param hdr_validation_flags: An instance of HeaderValidationFlags.
validate_outbound_headers
python
python-hyper/h2
src/h2/utilities.py
https://github.com/python-hyper/h2/blob/master/src/h2/utilities.py
MIT
def window_consumed(self, size: int) -> None: """ We have received a certain number of bytes from the remote peer. This necessarily shrinks the flow control window! :param size: The number of flow controlled bytes we received from the remote peer. :type size: ``int``...
We have received a certain number of bytes from the remote peer. This necessarily shrinks the flow control window! :param size: The number of flow controlled bytes we received from the remote peer. :type size: ``int`` :returns: Nothing. :rtype: ``None`` ...
window_consumed
python
python-hyper/h2
src/h2/windows.py
https://github.com/python-hyper/h2/blob/master/src/h2/windows.py
MIT
def window_opened(self, size: int) -> None: """ The flow control window has been incremented, either because of manual flow control management or because of the user changing the flow control settings. This can have the effect of increasing what we consider to be the "maximum" fl...
The flow control window has been incremented, either because of manual flow control management or because of the user changing the flow control settings. This can have the effect of increasing what we consider to be the "maximum" flow control window size. This does not increase...
window_opened
python
python-hyper/h2
src/h2/windows.py
https://github.com/python-hyper/h2/blob/master/src/h2/windows.py
MIT
def run_until_complete(self, *coroutines) -> None: """ Executes a set of coroutines that communicate between each other. Each one is, in order, passed the output of the previous coroutine until one is exhausted. If a coroutine does not initially yield data (that is, its first act...
Executes a set of coroutines that communicate between each other. Each one is, in order, passed the output of the previous coroutine until one is exhausted. If a coroutine does not initially yield data (that is, its first action is to receive data), the calling code should prime ...
run_until_complete
python
python-hyper/h2
tests/coroutine_tests.py
https://github.com/python-hyper/h2/blob/master/tests/coroutine_tests.py
MIT
def build_headers_frame(self, headers, flags=None, stream_id=1, **priority_kwargs): """ Builds a single valid headers frame out of the contained headers. """ if flags is None: ...
Builds a single valid headers frame out of the contained headers.
build_headers_frame
python
python-hyper/h2
tests/helpers.py
https://github.com/python-hyper/h2/blob/master/tests/helpers.py
MIT
def build_continuation_frame(self, header_block, flags=None, stream_id=1): """ Builds a single continuation frame out of the binary header block. """ if flags is None: flags = [] f = ContinuationFrame(stream_id) f.data = header_block f.flags = set(flag...
Builds a single continuation frame out of the binary header block.
build_continuation_frame
python
python-hyper/h2
tests/helpers.py
https://github.com/python-hyper/h2/blob/master/tests/helpers.py
MIT
def build_data_frame(self, data, flags=None, stream_id=1, padding_len=0): """ Builds a single data frame out of a chunk of data. """ flags = set(flags) if flags is not None else set() f = DataFrame(stream_id) f.data = data f.flags = flags if padding_len: ...
Builds a single data frame out of a chunk of data.
build_data_frame
python
python-hyper/h2
tests/helpers.py
https://github.com/python-hyper/h2/blob/master/tests/helpers.py
MIT
def test_sending_headers(self) -> None: """ Single headers frames are correctly encoded. """ c = h2.connection.H2Connection() c.initiate_connection() # Clear the data, then send headers. c.clear_outbound_data_buffer() events = c.send_headers(1, self.examp...
Single headers frames are correctly encoded.
test_sending_headers
python
python-hyper/h2
tests/test_basic_logic.py
https://github.com/python-hyper/h2/blob/master/tests/test_basic_logic.py
MIT
def test_sending_data(self) -> None: """ Single data frames are encoded correctly. """ c = h2.connection.H2Connection() c.initiate_connection() c.send_headers(1, self.example_request_headers) # Clear the data, then send some data. c.clear_outbound_data_bu...
Single data frames are encoded correctly.
test_sending_data
python
python-hyper/h2
tests/test_basic_logic.py
https://github.com/python-hyper/h2/blob/master/tests/test_basic_logic.py
MIT
def test_sending_data_with_padding(self) -> None: """ Single data frames with padding are encoded correctly. """ c = h2.connection.H2Connection() c.initiate_connection() c.send_headers(1, self.example_request_headers) # Clear the data, then send some data. ...
Single data frames with padding are encoded correctly.
test_sending_data_with_padding
python
python-hyper/h2
tests/test_basic_logic.py
https://github.com/python-hyper/h2/blob/master/tests/test_basic_logic.py
MIT
def test_sending_data_with_zero_length_padding(self) -> None: """ Single data frames with zero-length padding are encoded correctly. """ c = h2.connection.H2Connection() c.initiate_connection() c.send_headers(1, self.example_request_headers) # Clear the d...
Single data frames with zero-length padding are encoded correctly.
test_sending_data_with_zero_length_padding
python
python-hyper/h2
tests/test_basic_logic.py
https://github.com/python-hyper/h2/blob/master/tests/test_basic_logic.py
MIT
def test_sending_data_with_invalid_padding_length(self, expected_error, pad_length) -> None: """ ``send_data`` with a ``pad_length`` parameter that is an integer outside the range of [0, 2...
``send_data`` with a ``pad_length`` parameter that is an integer outside the range of [0, 255] throws a ``ValueError``, and a ``pad_length`` parameter which is not an ``integer`` type throws a ``TypeError``.
test_sending_data_with_invalid_padding_length
python
python-hyper/h2
tests/test_basic_logic.py
https://github.com/python-hyper/h2/blob/master/tests/test_basic_logic.py
MIT
def test_closing_stream_sending_data(self, frame_factory) -> None: """ We can close a stream with a data frame. """ c = h2.connection.H2Connection() c.initiate_connection() c.send_headers(1, self.example_request_headers) f = frame_factory.build_data_frame( ...
We can close a stream with a data frame.
test_closing_stream_sending_data
python
python-hyper/h2
tests/test_basic_logic.py
https://github.com/python-hyper/h2/blob/master/tests/test_basic_logic.py
MIT
def test_receiving_a_response(self, frame_factory) -> None: """ When receiving a response, the ResponseReceived event fires. """ config = h2.config.H2Configuration(header_encoding="utf-8") c = h2.connection.H2Connection(config=config) c.initiate_connection() c.sen...
When receiving a response, the ResponseReceived event fires.
test_receiving_a_response
python
python-hyper/h2
tests/test_basic_logic.py
https://github.com/python-hyper/h2/blob/master/tests/test_basic_logic.py
MIT
def test_receiving_a_response_bytes(self, frame_factory) -> None: """ When receiving a response, the ResponseReceived event fires with bytes headers if the encoding is set appropriately. """ config = h2.config.H2Configuration(header_encoding=False) c = h2.connection.H2Con...
When receiving a response, the ResponseReceived event fires with bytes headers if the encoding is set appropriately.
test_receiving_a_response_bytes
python
python-hyper/h2
tests/test_basic_logic.py
https://github.com/python-hyper/h2/blob/master/tests/test_basic_logic.py
MIT
def test_receiving_a_response_change_encoding(self, frame_factory) -> None: """ When receiving a response, the ResponseReceived event fires with bytes headers if the encoding is set appropriately, but if this changes then the change reflects it. """ config = h2.config.H2C...
When receiving a response, the ResponseReceived event fires with bytes headers if the encoding is set appropriately, but if this changes then the change reflects it.
test_receiving_a_response_change_encoding
python
python-hyper/h2
tests/test_basic_logic.py
https://github.com/python-hyper/h2/blob/master/tests/test_basic_logic.py
MIT
def test_cannot_send_headers_on_lower_stream_id(self) -> None: """ Once stream ID x has been used, cannot use stream ID y where y < x. """ c = h2.connection.H2Connection() c.initiate_connection() c.send_headers(3, self.example_request_headers, end_stream=False) w...
Once stream ID x has been used, cannot use stream ID y where y < x.
test_cannot_send_headers_on_lower_stream_id
python
python-hyper/h2
tests/test_basic_logic.py
https://github.com/python-hyper/h2/blob/master/tests/test_basic_logic.py
MIT
def test_receiving_pushed_stream(self, frame_factory) -> None: """ Pushed streams fire a PushedStreamReceived event, followed by ResponseReceived when the response headers are received. """ config = h2.config.H2Configuration(header_encoding="utf-8") c = h2.connection.H2Co...
Pushed streams fire a PushedStreamReceived event, followed by ResponseReceived when the response headers are received.
test_receiving_pushed_stream
python
python-hyper/h2
tests/test_basic_logic.py
https://github.com/python-hyper/h2/blob/master/tests/test_basic_logic.py
MIT
def test_receiving_pushed_stream_bytes(self, frame_factory) -> None: """ Pushed headers are not decoded if the header encoding is set to False. """ config = h2.config.H2Configuration(header_encoding=False) c = h2.connection.H2Connection(config=config) c.initiate_connectio...
Pushed headers are not decoded if the header encoding is set to False.
test_receiving_pushed_stream_bytes
python
python-hyper/h2
tests/test_basic_logic.py
https://github.com/python-hyper/h2/blob/master/tests/test_basic_logic.py
MIT
def test_cannot_receive_pushed_stream_when_enable_push_is_0(self, frame_factory) -> None: """ If we have set SETTINGS_ENABLE_PUSH to 0, receiving PUSH_PROMISE frames triggers the connection to be closed. """ c = h2.c...
If we have set SETTINGS_ENABLE_PUSH to 0, receiving PUSH_PROMISE frames triggers the connection to be closed.
test_cannot_receive_pushed_stream_when_enable_push_is_0
python
python-hyper/h2
tests/test_basic_logic.py
https://github.com/python-hyper/h2/blob/master/tests/test_basic_logic.py
MIT
def test_receiving_response_no_body(self, frame_factory) -> None: """ Receiving a response without a body fires two events, ResponseReceived and StreamEnded. """ c = h2.connection.H2Connection() c.initiate_connection() c.send_headers(1, self.example_request_header...
Receiving a response without a body fires two events, ResponseReceived and StreamEnded.
test_receiving_response_no_body
python
python-hyper/h2
tests/test_basic_logic.py
https://github.com/python-hyper/h2/blob/master/tests/test_basic_logic.py
MIT
def test_oversize_headers(self) -> None: """ Sending headers that are oversized generates a stream of CONTINUATION frames. """ all_bytes = [chr(x).encode("latin1") for x in range(256)] large_binary_string = b"".join( random.choice(all_bytes) for _ in range(25...
Sending headers that are oversized generates a stream of CONTINUATION frames.
test_oversize_headers
python
python-hyper/h2
tests/test_basic_logic.py
https://github.com/python-hyper/h2/blob/master/tests/test_basic_logic.py
MIT
def test_handle_stream_reset(self, frame_factory) -> None: """ Streams being remotely reset fires a StreamReset event. """ c = h2.connection.H2Connection() c.initiate_connection() c.send_headers(1, self.example_request_headers, end_stream=True) c.clear_outbound_da...
Streams being remotely reset fires a StreamReset event.
test_handle_stream_reset
python
python-hyper/h2
tests/test_basic_logic.py
https://github.com/python-hyper/h2/blob/master/tests/test_basic_logic.py
MIT
def test_handle_stream_reset_with_unknown_erorr_code(self, frame_factory) -> None: """ Streams being remotely reset with unknown error codes behave exactly as they do with known error codes, but the error code on the event is an int, instead of being an ErrorCodes. """ c ...
Streams being remotely reset with unknown error codes behave exactly as they do with known error codes, but the error code on the event is an int, instead of being an ErrorCodes.
test_handle_stream_reset_with_unknown_erorr_code
python
python-hyper/h2
tests/test_basic_logic.py
https://github.com/python-hyper/h2/blob/master/tests/test_basic_logic.py
MIT
def test_can_consume_partial_data_from_connection(self) -> None: """ We can do partial reads from the connection. """ c = h2.connection.H2Connection() c.initiate_connection() assert len(c.data_to_send(2)) == 2 assert len(c.data_to_send(3)) == 3 assert 0 <...
We can do partial reads from the connection.
test_can_consume_partial_data_from_connection
python
python-hyper/h2
tests/test_basic_logic.py
https://github.com/python-hyper/h2/blob/master/tests/test_basic_logic.py
MIT
def test_settings_get_acked_correctly(self, frame_factory) -> None: """ When settings changes are ACKed, they contain the changed settings. """ c = h2.connection.H2Connection() c.initiate_connection() new_settings = { h2.settings.SettingCodes.HEADER_TABLE_SIZ...
When settings changes are ACKed, they contain the changed settings.
test_settings_get_acked_correctly
python
python-hyper/h2
tests/test_basic_logic.py
https://github.com/python-hyper/h2/blob/master/tests/test_basic_logic.py
MIT
def test_cannot_create_new_outbound_stream_over_limit(self, frame_factory) -> None: """ When the number of outbound streams exceeds the remote peer's MAX_CONCURRENT_STREAMS setting, attempting to open new streams fails. """ c = h2.connection.H2Connection() c.initiate_conn...
When the number of outbound streams exceeds the remote peer's MAX_CONCURRENT_STREAMS setting, attempting to open new streams fails.
test_cannot_create_new_outbound_stream_over_limit
python
python-hyper/h2
tests/test_basic_logic.py
https://github.com/python-hyper/h2/blob/master/tests/test_basic_logic.py
MIT
def test_can_receive_trailers(self, frame_factory) -> None: """ When two HEADERS blocks are received in the same stream from a server, the second set are trailers. """ config = h2.config.H2Configuration(header_encoding="utf-8") c = h2.connection.H2Connection(config=config...
When two HEADERS blocks are received in the same stream from a server, the second set are trailers.
test_can_receive_trailers
python
python-hyper/h2
tests/test_basic_logic.py
https://github.com/python-hyper/h2/blob/master/tests/test_basic_logic.py
MIT
def test_reject_trailers_not_ending_stream(self, frame_factory) -> None: """ When trailers are received without the END_STREAM flag being present, this is a ProtocolError. """ c = h2.connection.H2Connection() c.initiate_connection() c.send_headers(1, self.example_...
When trailers are received without the END_STREAM flag being present, this is a ProtocolError.
test_reject_trailers_not_ending_stream
python
python-hyper/h2
tests/test_basic_logic.py
https://github.com/python-hyper/h2/blob/master/tests/test_basic_logic.py
MIT
def test_can_send_trailers(self, frame_factory) -> None: """ When a second set of headers are sent, they are properly trailers. """ c = h2.connection.H2Connection() c.initiate_connection() c.clear_outbound_data_buffer() c.send_headers(1, self.example_request_heade...
When a second set of headers are sent, they are properly trailers.
test_can_send_trailers
python
python-hyper/h2
tests/test_basic_logic.py
https://github.com/python-hyper/h2/blob/master/tests/test_basic_logic.py
MIT
def test_trailers_must_have_end_stream(self, frame_factory) -> None: """ A set of trailers must carry the END_STREAM flag. """ c = h2.connection.H2Connection() c.initiate_connection() # Send headers. c.send_headers(1, self.example_request_headers) # Now ...
A set of trailers must carry the END_STREAM flag.
test_trailers_must_have_end_stream
python
python-hyper/h2
tests/test_basic_logic.py
https://github.com/python-hyper/h2/blob/master/tests/test_basic_logic.py
MIT
def test_headers_are_lowercase(self, frame_factory) -> None: """ When headers are sent, they are forced to lower-case. """ weird_headers = [*self.example_request_headers, ("ChAnGiNg-CaSe", "AlsoHere"), ("alllowercase", "alllowercase"), ("ALLCAPS", "ALLCAPS")] expected_headers = [...
When headers are sent, they are forced to lower-case.
test_headers_are_lowercase
python
python-hyper/h2
tests/test_basic_logic.py
https://github.com/python-hyper/h2/blob/master/tests/test_basic_logic.py
MIT
def test_outbound_cookie_headers_are_split(self) -> None: """ We should split outbound cookie headers according to RFC 7540 - 8.1.2.5 """ cookie_headers = [ HeaderTuple("cookie", "username=John Doe; expires=Thu, 18 Dec 2013 12:00:00 UTC"), ...
We should split outbound cookie headers according to RFC 7540 - 8.1.2.5
test_outbound_cookie_headers_are_split
python
python-hyper/h2
tests/test_basic_logic.py
https://github.com/python-hyper/h2/blob/master/tests/test_basic_logic.py
MIT
def test_changing_max_frame_size(self, frame_factory, frame_size) -> None: """ When the user changes the max frame size and the change is ACKed, the remote peer is now bound by the new frame size. """ # We need to refresh the encoder because hypothesis has a problem with ...
When the user changes the max frame size and the change is ACKed, the remote peer is now bound by the new frame size.
test_changing_max_frame_size
python
python-hyper/h2
tests/test_basic_logic.py
https://github.com/python-hyper/h2/blob/master/tests/test_basic_logic.py
MIT
def test_cookies_are_joined_on_push(self, frame_factory) -> None: """ RFC 7540 Section 8.1.2.5 requires that we join multiple Cookie headers in a header block together when they're received on a push. """ # This is a moderately varied set of cookie headers: some combined, ...
RFC 7540 Section 8.1.2.5 requires that we join multiple Cookie headers in a header block together when they're received on a push.
test_cookies_are_joined_on_push
python
python-hyper/h2
tests/test_basic_logic.py
https://github.com/python-hyper/h2/blob/master/tests/test_basic_logic.py
MIT
def test_cookies_arent_joined_without_normalization(self, frame_factory) -> None: """ If inbound header normalization is disabled, cookie headers aren't joined. """ # This is a moderately varied set of cookie headers: some combined, # some split. cookie_headers = ...
If inbound header normalization is disabled, cookie headers aren't joined.
test_cookies_arent_joined_without_normalization
python
python-hyper/h2
tests/test_basic_logic.py
https://github.com/python-hyper/h2/blob/master/tests/test_basic_logic.py
MIT
def test_ignores_preamble(self) -> None: """ The preamble does not cause any events or frames to be written. """ c = h2.connection.H2Connection(config=self.server_config) preamble = b"PRI * HTTP/2.0\r\n\r\nSM\r\n\r\n" events = c.receive_data(preamble) assert not ...
The preamble does not cause any events or frames to be written.
test_ignores_preamble
python
python-hyper/h2
tests/test_basic_logic.py
https://github.com/python-hyper/h2/blob/master/tests/test_basic_logic.py
MIT
def test_drip_feed_preamble(self, chunk_size) -> None: """ The preamble can be sent in in less than a single buffer. """ c = h2.connection.H2Connection(config=self.server_config) preamble = b"PRI * HTTP/2.0\r\n\r\nSM\r\n\r\n" events = [] for i in range(0, len(pre...
The preamble can be sent in in less than a single buffer.
test_drip_feed_preamble
python
python-hyper/h2
tests/test_basic_logic.py
https://github.com/python-hyper/h2/blob/master/tests/test_basic_logic.py
MIT
def test_initiate_connection_sends_server_preamble(self, frame_factory) -> None: """ For server-side connections, initiate_connection sends a server preamble. """ c = h2.connection.H2Connection(config=self.server_config) expected_settings = frame_factory.build_settings_fr...
For server-side connections, initiate_connection sends a server preamble.
test_initiate_connection_sends_server_preamble
python
python-hyper/h2
tests/test_basic_logic.py
https://github.com/python-hyper/h2/blob/master/tests/test_basic_logic.py
MIT
def test_headers_event(self, frame_factory) -> None: """ When a headers frame is received a RequestReceived event fires. """ c = h2.connection.H2Connection(config=self.server_config) c.receive_data(frame_factory.preamble()) f = frame_factory.build_headers_frame(self.exam...
When a headers frame is received a RequestReceived event fires.
test_headers_event
python
python-hyper/h2
tests/test_basic_logic.py
https://github.com/python-hyper/h2/blob/master/tests/test_basic_logic.py
MIT
def test_headers_event_bytes(self, frame_factory) -> None: """ When a headers frame is received a RequestReceived event fires with bytes headers if the encoding is set appropriately. """ config = h2.config.H2Configuration( client_side=False, header_encoding=False, ...
When a headers frame is received a RequestReceived event fires with bytes headers if the encoding is set appropriately.
test_headers_event_bytes
python
python-hyper/h2
tests/test_basic_logic.py
https://github.com/python-hyper/h2/blob/master/tests/test_basic_logic.py
MIT
def test_data_event(self, frame_factory) -> None: """ Test that data received on a stream fires a DataReceived event. """ c = h2.connection.H2Connection(config=self.server_config) c.receive_data(frame_factory.preamble()) f1 = frame_factory.build_headers_frame( ...
Test that data received on a stream fires a DataReceived event.
test_data_event
python
python-hyper/h2
tests/test_basic_logic.py
https://github.com/python-hyper/h2/blob/master/tests/test_basic_logic.py
MIT
def test_data_event_with_padding(self, frame_factory) -> None: """ Test that data received on a stream fires a DataReceived event that accounts for padding. """ c = h2.connection.H2Connection(config=self.server_config) c.receive_data(frame_factory.preamble()) f1 ...
Test that data received on a stream fires a DataReceived event that accounts for padding.
test_data_event_with_padding
python
python-hyper/h2
tests/test_basic_logic.py
https://github.com/python-hyper/h2/blob/master/tests/test_basic_logic.py
MIT
def test_receiving_ping_frame(self, frame_factory) -> None: """ Ping frames should be immediately ACKed. """ c = h2.connection.H2Connection(config=self.server_config) c.receive_data(frame_factory.preamble()) ping_data = b"\x01" * 8 sent_frame = frame_factory.buil...
Ping frames should be immediately ACKed.
test_receiving_ping_frame
python
python-hyper/h2
tests/test_basic_logic.py
https://github.com/python-hyper/h2/blob/master/tests/test_basic_logic.py
MIT
def test_receiving_settings_frame_event(self, frame_factory) -> None: """ Settings frames should cause a RemoteSettingsChanged event to fire. """ c = h2.connection.H2Connection(config=self.server_config) c.receive_data(frame_factory.preamble()) f = frame_factory.build_se...
Settings frames should cause a RemoteSettingsChanged event to fire.
test_receiving_settings_frame_event
python
python-hyper/h2
tests/test_basic_logic.py
https://github.com/python-hyper/h2/blob/master/tests/test_basic_logic.py
MIT
def test_basic_sending_ping_frame_logic(self, frame_factory) -> None: """ Sending ping frames serializes a ping frame on stream 0 with appropriate opaque data. """ c = h2.connection.H2Connection(config=self.server_config) c.receive_data(frame_factory.preamble()) c...
Sending ping frames serializes a ping frame on stream 0 with appropriate opaque data.
test_basic_sending_ping_frame_logic
python
python-hyper/h2
tests/test_basic_logic.py
https://github.com/python-hyper/h2/blob/master/tests/test_basic_logic.py
MIT
def test_ping_frame_opaque_data_must_be_length_8_bytestring(self, frame_factory, opaque_data) -> None: """ Sending a ping frame only works with 8-byte bytestrings. """ ...
Sending a ping frame only works with 8-byte bytestrings.
test_ping_frame_opaque_data_must_be_length_8_bytestring
python
python-hyper/h2
tests/test_basic_logic.py
https://github.com/python-hyper/h2/blob/master/tests/test_basic_logic.py
MIT
def test_receiving_ping_acknowledgement(self, frame_factory) -> None: """ Receiving a PING acknowledgement fires a PingAckReceived event. """ c = h2.connection.H2Connection(config=self.server_config) c.receive_data(frame_factory.preamble()) ping_data = b"\x01\x02\x03\x04...
Receiving a PING acknowledgement fires a PingAckReceived event.
test_receiving_ping_acknowledgement
python
python-hyper/h2
tests/test_basic_logic.py
https://github.com/python-hyper/h2/blob/master/tests/test_basic_logic.py
MIT
def test_stream_ended_remotely(self, frame_factory) -> None: """ When the remote stream ends with a non-empty data frame a DataReceived event and a StreamEnded event are fired. """ c = h2.connection.H2Connection(config=self.server_config) c.receive_data(frame_factory.prea...
When the remote stream ends with a non-empty data frame a DataReceived event and a StreamEnded event are fired.
test_stream_ended_remotely
python
python-hyper/h2
tests/test_basic_logic.py
https://github.com/python-hyper/h2/blob/master/tests/test_basic_logic.py
MIT
def test_cannot_push_streams_when_disabled(self, frame_factory) -> None: """ When the remote peer has disabled stream pushing, we should fail. """ c = h2.connection.H2Connection(config=self.server_config) c.receive_data(frame_factory.preamble()) f = frame_factory.build_se...
When the remote peer has disabled stream pushing, we should fail.
test_cannot_push_streams_when_disabled
python
python-hyper/h2
tests/test_basic_logic.py
https://github.com/python-hyper/h2/blob/master/tests/test_basic_logic.py
MIT
def test_settings_remote_change_header_table_size(self, frame_factory) -> None: """ Acknowledging a remote HEADER_TABLE_SIZE settings change causes us to change the header table size of our encoder. """ c = h2.connection.H2Connection(config=self.server_config) c.receive_d...
Acknowledging a remote HEADER_TABLE_SIZE settings change causes us to change the header table size of our encoder.
test_settings_remote_change_header_table_size
python
python-hyper/h2
tests/test_basic_logic.py
https://github.com/python-hyper/h2/blob/master/tests/test_basic_logic.py
MIT
def test_settings_local_change_header_table_size(self, frame_factory) -> None: """ The remote peer acknowledging a local HEADER_TABLE_SIZE settings change does not cause us to change the header table size of our decoder. For an explanation of why this test is this way around, see issue ...
The remote peer acknowledging a local HEADER_TABLE_SIZE settings change does not cause us to change the header table size of our decoder. For an explanation of why this test is this way around, see issue #37.
test_settings_local_change_header_table_size
python
python-hyper/h2
tests/test_basic_logic.py
https://github.com/python-hyper/h2/blob/master/tests/test_basic_logic.py
MIT
def test_restricting_outbound_frame_size_by_settings(self, frame_factory) -> None: """ The remote peer can shrink the maximum outbound frame size using settings. """ c = h2.connection.H2Connection(config=self.server_config) c.initiate_connection() c.receive_data(f...
The remote peer can shrink the maximum outbound frame size using settings.
test_restricting_outbound_frame_size_by_settings
python
python-hyper/h2
tests/test_basic_logic.py
https://github.com/python-hyper/h2/blob/master/tests/test_basic_logic.py
MIT
def test_restricting_inbound_frame_size_by_settings(self, frame_factory) -> None: """ We throw ProtocolErrors and tear down connections if oversize frames are received. """ c = h2.connection.H2Connection(config=self.server_config) c.receive_data(frame_factory.preamble()) ...
We throw ProtocolErrors and tear down connections if oversize frames are received.
test_restricting_inbound_frame_size_by_settings
python
python-hyper/h2
tests/test_basic_logic.py
https://github.com/python-hyper/h2/blob/master/tests/test_basic_logic.py
MIT
def test_cannot_receive_new_streams_over_limit(self, frame_factory) -> None: """ When the number of inbound streams exceeds our MAX_CONCURRENT_STREAMS setting, their attempt to open new streams fails. """ c = h2.connection.H2Connection(config=self.server_config) c.receive...
When the number of inbound streams exceeds our MAX_CONCURRENT_STREAMS setting, their attempt to open new streams fails.
test_cannot_receive_new_streams_over_limit
python
python-hyper/h2
tests/test_basic_logic.py
https://github.com/python-hyper/h2/blob/master/tests/test_basic_logic.py
MIT
def test_can_receive_trailers(self, frame_factory) -> None: """ When two HEADERS blocks are received in the same stream from a client, the second set are trailers. """ c = h2.connection.H2Connection(config=self.server_config) c.receive_data(frame_factory.preamble()) ...
When two HEADERS blocks are received in the same stream from a client, the second set are trailers.
test_can_receive_trailers
python
python-hyper/h2
tests/test_basic_logic.py
https://github.com/python-hyper/h2/blob/master/tests/test_basic_logic.py
MIT
def test_can_send_goaway_repeatedly(self, frame_factory) -> None: """ We can send a GOAWAY frame as many times as we like. """ c = h2.connection.H2Connection(config=self.server_config) c.receive_data(frame_factory.preamble()) c.clear_outbound_data_buffer() c.clos...
We can send a GOAWAY frame as many times as we like.
test_can_send_goaway_repeatedly
python
python-hyper/h2
tests/test_basic_logic.py
https://github.com/python-hyper/h2/blob/master/tests/test_basic_logic.py
MIT
def test_receiving_goaway_frame(self, frame_factory) -> None: """ Receiving a GOAWAY frame causes a ConnectionTerminated event to be fired and transitions the connection to the CLOSED state, and clears the outbound data buffer. """ c = h2.connection.H2Connection(config=se...
Receiving a GOAWAY frame causes a ConnectionTerminated event to be fired and transitions the connection to the CLOSED state, and clears the outbound data buffer.
test_receiving_goaway_frame
python
python-hyper/h2
tests/test_basic_logic.py
https://github.com/python-hyper/h2/blob/master/tests/test_basic_logic.py
MIT