Ticket #4173: websockets-tls.diff

File websockets-tls.diff, 615 bytes (added by tekNico, 4 years ago)

Enable TLS encryption on websockets (by tekNico and frankban)

  • .py

    old new  
    509509
    510510        # Connect the transport to our factory, and make things go. We need to
    511511        # do some stupid stuff here; see #3204, which could fix it.
    512         transport.protocol = protocol
     512        if request.isSecure():
     513            # Secure connections wrap in TLSMemoryBIOProtocol too.
     514            transport.protocol.wrappedProtocol = protocol
     515        else:
     516            transport.protocol = protocol
    513517        protocol.makeConnection(transport)
    514518
    515519        return NOT_DONE_YET