Closed goodboy closed 3 years ago
I assume you're running wsproto 1.0?
Please try wsproto 0.14 to narrow things down.
I don't think so actually.
When I upgrade to 0.9.0
I get wsproto==0.14.1
.
Code is in a muck atm will report back with downgrade to 0.14
shortly!
Right, I meant 0.14.1. Does sound like a regression in trio-websockets then.
This regressed in 0233e2176731a190a515c025c0762c19fbde7821.
It boils down to:
yarl.URL("wss://ws.kraken.com").path # '/'
urllib.parse.urlsplit("wss://ws.kraken.com").path # ''
and h11 doesn't like this empty path.
I'll need to look a bit to find the correct fix, but for now you can work around it by using wss://ws.kraken.com/
(note the trailing slash).
RFC 3986 (URL spec) says a zero-length path is allowed, so the urlsplit
result on itself is correct.
RFC 7230 (HTTP spec) says "If the target URI's path component is empty, the client MUST send "/" as the path within the origin-form of request-target.". So h11 is strictly correct there.
So I guess now the question is where should the path if path else '/'
condition go: trio-websocket, wsproto, h11?
Since h11 and wsproto both use the HTTP term target
, and only trio-websocket
use the term path
, and handles URLs, I think it should go in trio-websocket. I'll send a PR.
There is a similar issue if you supply an empty resource in the trio_websocket.open_websocket
and trio_websocket.connect_websocket
calls.
@bluetech amazing. thanks for the investigation and fix!
I assume minor release will include this soonish?
I'll need to look a bit to find the correct fix, but for now you can work around it by using wss://ws.kraken.com/ (note the trailing slash).
Will probably use this in meantime.
@goodboy, @belm0 has already released 0.9.1!
@andersea These ones are not entirely clear-cut like the URL one, I mean I'm not sure I'd consider ''
to be a "resource". And I also figure it was always the behavior...
@bluetech indeed this is all solved for me thanks for the help :surfer:
Not sure who's guilty here (kraken's impl or this client) but downgrading to
0.8.1
resolves the problem. Their api has been in production for a while.Test code:
On
0.8.1
this yields no output but on0.9.0
this errors with:Please feel free to adjust the issue title, I haven't dug into this at all other then quick looks through the debugger stack.
Underlying issue seems to be the
h11._events.Request.target
isb''
and it dies inside.validate()
?