wsproto
wsproto copied to clipboard
Sans-IO WebSocket protocol implementation
RFC6455 writes about the `Sec-WebSocket-Protocol` header: > The |Sec-WebSocket-Protocol| header field MAY appear multiple times in an HTTP request (**which is logically the same as a single |Sec-WebSocket-Protocol| header field...
In `h11`, the `target` argument to `h11.Request` is typed as `Union[bytes, str]` (see the [latest docs](https://h11.readthedocs.io/en/latest/api.html?highlight=request#h11.Request)). Note that it was [already the case](https://h11.readthedocs.io/en/v0.9.0/api.html?highlight=request#h11.Request) in version `0.9.0`. IMO, it would make...
At the moment, the `wsproto.typing.Header` type is not compatible with `h11._headers.Header` which is defined as the following, starting with version `0.13.0`: ```python class Headers(Sequence[Tuple[bytes, bytes]]): [...] ``` The following patch...
Of three events that require "trivial" response, `Request`, `CloseConnection`, and `Ping`, two implement `response()`, but one, `Request`, does not. If it did had `response()` method that returns `AcceptConnection()`, event processing...
reproduce: ```python from wsproto.connection import Connection, ConnectionState, ConnectionType from wsproto.events import CloseConnection, TextMessage from wsproto.frame_protocol import CloseReason from wsproto.utilities import LocalProtocolError def test_send_after_close(): client = Connection(ConnectionType.CLIENT) server = Connection(ConnectionType.SERVER) OPEN...
I changed both the encoding and the decoding of the Host, as I assume it is internally represented as Unicode.
copied from https://github.com/mitmproxy/mitmproxy/issues/4622 We should IDNA-encode the Host header during the WS handshake in https://github.com/python-hyper/wsproto/blob/master/src/wsproto/handshake.py#L327
using the newly minted `bench/connection.py` with some tweaks: ``` $ pip install wsproto==0.14.1 wsaccel $ python bench/connection.py 4.636s elapsed, 93usec per iteration $ pip install wsproto==1.0.0 $ python bench/connection.py 5.192s...
```python x = wsproto.events.CloseConnection(wsproto.frame_protocol.CloseReason.NO_STATUS_RCVD) ws.send(x) ``` currently emits a close frame with status code 1000 (NORMAL_CLOSURE) instead of not sending a payload. This PR fixes this. `NO_STATUS_RCVD` should probably be...
Apparently the autobahn tests 12.5.* have a bug where they send invalid utf8: https://github.com/aaugustin/websockets/pull/178#issuecomment-302923540 https://github.com/crossbario/autobahn-testsuite/issues/71 How can we be passing these tests? It seems like a correct implementation has to...