[Twisted-Python] Add support for Next Protocol Negotiation and Application Layer Protocol Negotiation

Phil Mayers p.mayers at imperial.ac.uk
Tue Apr 21 10:10:33 MDT 2015


On 21/04/15 16:25, Adi Roiban wrote:
> Hi,
>
> I just want to let you know about this patch which is in work :
> https://twistedmatrix.com/trac/ticket/7860

Nice.

>
> I did an initial review but it would help to get more feedback for this new API.

I would very, very much like to see something along the lines of a 
factory-of-factories which handles creating the protocol instances on 
connections automatically.

Straw-man API:

class NegoFactory(tls.NegoFactory):
     nextProtocols = ('h2', 'http/1.1')

     def buildProtocol(self, addr, nextproto):
       if nextproto=='h2':
         return H2Proto()
       elif nextproto=='http/1.1':
         return HttpProto()
       else:
         raise NotImplemented()

f = NegoFactory()
listenSSL(port, f)

The basic protocol level support is great, but it'll be much easier to 
use if there's a Twisted-like API on top of it.

But don't block the main ticket - open another one up maybe?




More information about the Twisted-Python mailing list