Commit 3c2bbf06 by Szeberényi Imre

probababa

parent 4ab0c770
......@@ -6,7 +6,7 @@ from os import environ
from twisted.internet import defer
from twisted.internet import protocol
from twisted.internet.protocol import Factory, Protocol
from twisted.internet.protocol import Factory, Protocol, ServerFactory
from twisted.internet import reactor
from twisted.web.static import File
......@@ -78,6 +78,7 @@ class ProxyClientFactory(protocol.ReconnectingClientFactory):
class VNCWebSocketHandler(Protocol):
def makeConnection(self, transport):
print("hoho")
try:
value = signing.loads(transport.request.args['d'][0],
key=PROXY_SECRET, max_age=KEY_MAX_AGE)
......@@ -123,9 +124,12 @@ class VNCWebSocketHandler(Protocol):
logger.info("Server(%s): disconnected", self.src)
class VNCWebSocketFactory(Factory):
class VNCWebSocketFactory(ServerFactory):
protocol = VNCWebSocketHandler
def buildprotocol(addr):
print(addr)
if __name__ == "__main__":
parser = optparse.OptionParser()
......@@ -133,8 +137,9 @@ if __name__ == "__main__":
help="loglevel")
opts, args = parser.parse_args()
logging.basicConfig(level=opts.loglevel)
print(lookupProtocolForFactory(VNCWebSocketFactory()))
resource = File('.')
resource.putChild('vnc', WebSocketsResource(
resource.putChild(b'vnc', WebSocketsResource(
lookupProtocolForFactory(VNCWebSocketFactory())))
reactor.listenTCP(9999, Site(resource))
reactor.run()
......@@ -2,4 +2,4 @@ cryptography==36.0.1
Django==3.2.3
Twisted==16.6.0
pyOpenSSL==21.0.0
service-identity
......@@ -365,6 +365,7 @@ class WebSocketsProtocol(Protocol):
@since: 13.2
"""
_buffer = None
print("BBBBB")
def __init__(self, receiver):
self._receiver = receiver
......@@ -382,6 +383,7 @@ class WebSocketsProtocol(Protocol):
"""
Find frames in incoming data and pass them to the underlying protocol.
"""
for opcode, data, fin in _parseFrames(self._buffer):
if opcode == CONTROLS.CLOSE:
# The other side wants us to close.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment