

def _receive_headers_frame(self, frame):
    '\n        Receive a headers frame on the connection.\n        '
    if (frame.stream_id not in self.streams):
        max_open_streams = self.local_settings.max_concurrent_streams
        if ((self.open_inbound_streams + 1) > max_open_streams):
            raise TooManyStreamsError(('Max outbound streams is %d, %d open' % (max_open_streams, self.open_outbound_streams)))
    try:
        headers = self.decoder.decode(frame.data, raw=True)
    except (HPACKError, IndexError, TypeError, UnicodeDecodeError) as e:
        raise ProtocolError(('Error decoding header block: %s' % e))
    headers = validate_headers(headers)
    events = self.state_machine.process_input(ConnectionInputs.RECV_HEADERS)
    stream = self._get_or_create_stream(frame.stream_id, AllowedStreamIDs((not self.client_side)))
    (frames, stream_events) = stream.receive_headers(headers, ('END_STREAM' in frame.flags), self.header_encoding)
    if ('PRIORITY' in frame.flags):
        (p_frames, p_events) = self._receive_priority_frame(frame)
        stream_events.extend(p_events)
        assert (not p_frames)
    return (frames, (e + stream_events))

dataset/ETHPy150Open python-hyper/hyper-h2/h2/connection.py H2Connection._receive_headers_frame/VarMisuse@226/357 `events`->`e`