Commit 8db0a06c authored by Taddeüs Kroes's avatar Taddeüs Kroes

Fixed bug where default extension parameters were ignored

parent 4388fc5c
......@@ -23,6 +23,12 @@ class Extension(object):
return '<Extension "%s" defaults=%s request=%s>' \
% (self.name, self.defaults, self.request)
def create_hook(self, **kwargs):
params = {}
params.update(self.defaults)
params.update(kwargs)
return self.Hook(**params)
class Hook:
def __init__(self, **kwargs):
for param, value in kwargs.iteritems():
......
......@@ -154,7 +154,7 @@ class ServerHandshake(Handshake):
self.wsock.extensions = filter_extensions(extensions)
for ext, params in zip(self.wsock.extensions, all_params):
hook = ext.Hook(**params)
hook = ext.create_hook(**params)
self.wsock.add_hook(send=hook.send, recv=hook.recv)
else:
self.wsock.extensions = []
......@@ -249,7 +249,7 @@ class ClientHandshake(Handshake):
raise HandshakeError('server handshake contains '
'unsupported extension "%s"' % name)
hook = supported_ext[name].Hook(**params)
hook = supported_ext[name].create_hook(**params)
self.wsock.extensions.append(supported_ext[name])
self.wsock.add_hook(send=hook.send, recv=hook.recv)
......
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