Opened 6 years ago

#237 new enhancement

share a Listener with HTTP

Reported by: Brian Warner Owned by:
Priority: major Milestone: undecided
Component: negotiation Version: 0.7.0
Keywords: Cc:

Description

For Tahoe's "storage server over HTTP" project (tahoe#510), it would be awfully handy if a single TCP port could host both a Foolscap Tub and a regular web server (twisted.web.server). I think the easiest way to do this would be to have our Negotiation protocol notice that the client didn't provide the "please switch protocols" header, create a new HTTPServer protocol instance, connect it to the transport, then write in all the buffered header text. The switch would look a lot like how Negotiation hands off to Banana, except it has to deal with leftover input bytes too.

The UI would be something like:

l = tub.listenOn("tcp:1234")
l.addHTTPServer(twisted.web.server.Site(root))

I don't know how to make this work with HTTPS (it might help that HTTP-over-TLS is traditionally run at a different port than unencrypted HTTP, but we'd still need two separate --listen= arguments for Tahoe). To do it properly, we'd need the foolscap Negotiation object to handle using TLS right off the bat, instead of using startTLS(). That would preclude sharing a listening port between multiple Tubs (since we must commit to a specific certificate before hearing the GET that asks for a TubID), and the initial who-do-you-want message would happen *inside* the TLS session, instead of outside. Probably feasible, but a bit trickier than the Foolscap+HTTP case.

Change History (0)

Note: See TracTickets for help on using tickets.