crossbario / autobahn-python

WebSocket and WAMP in Python for Twisted and asyncio
https://crossbar.io/autobahn
MIT License
2.48k stars 768 forks source link

transport takeover on HTTP/2 twisted endpoints #1070

Open meejah opened 6 years ago

meejah commented 6 years ago

See https://github.com/crossbario/autobahn-python/issues/1064#issuecomment-432932099

It seems that our method of "taking over" a transport doesn't work nicely for HTTP/2 connections (.transport is None in those cases, and .channel seem to probably be the right thing to take over). Needs some more investigation

meejah commented 6 years ago

(But also: does websocket even make any sense at all on http/2? There's no spec yet AFAIK .. but we should still fail more gracefully here)

oberstet commented 6 years ago

no, there is no websocket-over-http, and we don't need it, since we take over the complete transport (everything above TLS)

meejah commented 6 years ago

Right, I'm talking about our twisted Resource that takes over the HTTP transport. It doesn't work at all if e.g. you have h2 installed because then it uses HTTP2 and request.transport is None in that case so the takeover just blows up.

oberstet commented 6 years ago

Ah, ok. Yes, I think I only tested Universal Transport, which works, because it can split off WebSocket/RawSocket before Twisted Web. But for Web Transports, Twisted Web is in charge (first), and yes, it would be great to have a supported method/way in Twisted to take over transports for us to use, so we don't have to come up with hacks like this that break at some point ..