Skip to content

2.5.0 possible backward-incompatibility #367

Closed
@Kriechi

Description

@Kriechi

Hi,

we are getting a test failure in @mitmproxy with the latest h2 release (2.5.0):

Calling h2_conn.send_headers(event.stream_id, headers) with these headers

[(':status', '200'), ('priority_exclusive', True), ('priority_depends_on', 42424242), ('priority_weight', 42)]

results in the following traceback:

Traceback (most recent call last):
  File ".../mitmproxy/test/mitmproxy/protocol/test_http2.py", line 77, in handle
    if not self.server.handle_server_event(event, h2_conn, self.rfile, self.wfile):
  File ".../mitmproxy/test/mitmproxy/protocol/test_http2.py", line 305, in handle_server_event
    h2_conn.send_headers(event.stream_id, headers)
  File ".../h2/connection.py", line 803, in send_headers
    headers, self.encoder, end_stream
  File ".../h2/stream.py", line 788, in send_headers
    headers, encoder, hf, hdr_validation_flags
  File ".../h2/stream.py", line 1119, in _build_headers_frames
    encoded_headers = encoder.encode(headers)
  File ".../hpack/hpack.py", line 229, in encode
    for header in headers:
  File ".../h2/utilities.py", line 302, in _reject_pseudo_header_fields
    for header in headers:
  File ".../h2/utilities.py", line 271, in _reject_connection_header
    for header in headers:
  File ".../h2/utilities.py", line 255, in _reject_te
    for header in headers:
  File ".../h2/utilities.py", line 69, in _secure_headers
    for header in headers:
  File ".../h2/utilities.py", line 437, in _strip_surrounding_whitespace
    yield (header[0].strip(), header[1].strip())
AttributeError: 'bool' object has no attribute 'strip'

With earlier versions of h2 this code was working just fine.
I guess ('priority_exclusive', True) has to be a str now, and not bool?
I could not see any mentioning of that in the changlelog - if this was done by choice, or maybe it is a side effect?

ref mitmproxy/mitmproxy#1671

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions