Commit 2963b26e authored by Taddeüs Kroes's avatar Taddeüs Kroes

Added DeflateFrame to test server, some bugfixes to fully enable extensions

parent 6ec710a5
......@@ -74,7 +74,7 @@ class DeflateFrame(Extension):
if cto is not False and cto is not True:
raise ValueError('"no_context_takeover" must have no value')
class Hook:
class Hook(Extension.Hook):
def send(self, frame):
if not frame.rsv1:
frame.rsv1 = True
......@@ -116,7 +116,7 @@ class Multiplex(Extension):
# TODO: check "quota" value
class Hook:
class Hook(Extension.Hook):
def send(self, frame):
raise NotImplementedError # TODO
......@@ -129,9 +129,9 @@ def filter_extensions(extensions):
Remove extensions that use conflicting rsv bits and/or opcodes, with the
first options being the most preferable.
"""
rsv1_reserved = True
rsv2_reserved = True
rsv3_reserved = True
rsv1_reserved = False
rsv2_reserved = False
rsv3_reserved = False
opcodes_reserved = []
compat = []
......
......@@ -119,12 +119,12 @@ class ServerHandshake(Handshake):
# Origin must be present if browser client, and must match the list of
# trusted origins
if 'Origin' not in headers and 'User-Agent' in headers:
self.fail('browser client must specify "Origin" header')
origin = headers.get('Origin', 'null')
if origin == 'null':
if 'User-Agent' in headers:
self.fail('browser client must specify "Origin" header')
if ssock.trusted_origins:
self.fail('no "Origin" header specified, assuming untrusted')
elif ssock.trusted_origins and origin not in ssock.trusted_origins:
......@@ -390,7 +390,7 @@ def parse_param_hdr(hdr):
params[key] = value
yield name, params
return name, params
def format_param_hdr(value, params):
......
......@@ -7,6 +7,7 @@ basepath = abspath(dirname(abspath(__file__)) + '/..')
sys.path.insert(0, basepath)
from server import Server
from extension import DeflateFrame
class EchoServer(Server):
......@@ -15,7 +16,11 @@ class EchoServer(Server):
client.send(message)
class WebkitDeflateFrame(DeflateFrame):
name = 'x-webkit-deflate-frame'
if __name__ == '__main__':
EchoServer(('localhost', 8000),
EchoServer(('localhost', 8000), extensions=[WebkitDeflateFrame()],
#ssl_args=dict(keyfile='cert.pem', certfile='cert.pem'),
loglevel=logging.DEBUG).run()
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 to comment