﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc
237	share a Listener with HTTP	Brian Warner		"For Tahoe's ""storage server over HTTP"" project ([https://tahoe-lafs.org/trac/tahoe-lafs/ticket/510 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.
"	enhancement	new	major	undecided	negotiation	0.7.0			
