Skip to content

error_status_hint = 400 even when we are the client #41

@vfaronov

Description

@vfaronov
import h11
conn = h11.Connection(our_role=h11.CLIENT)
conn.send(h11.Request(method='GET', target='/', headers=[('Host', 'foo')]))
conn.send(h11.EndOfMessage())
conn.receive_data(b'')
try:
    conn.next_event()
except h11.RemoteProtocolError as exc:
    print(exc.error_status_hint)

This prints:

400

The error_status_hint might make sense when our_role=h11.CLIENT insofar as a server may be acting as a gateway. In that case, it may be more useful to have this hint set to 502 (Bad Gateway). Or perhaps removed altogether, so that (presumably) the server’s default 5xx kicks in — but this would be a breaking API change.

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