Commit f281e9ab authored by Taddeüs Kroes's avatar Taddeüs Kroes

Worked on extensions

parent 9d12f4e5
......@@ -8,3 +8,4 @@ from frame import Frame, ControlFrame, OPCODE_CONTINUATION, OPCODE_TEXT, \
from connection import Connection
from message import Message, TextMessage, BinaryMessage
from errors import SocketClosed
from extension import Extension, DeflateFrame
......@@ -21,6 +21,9 @@ class Extension(object):
setattr(self, param, value)
def client_params(self, frame):
return {}
def hook_send(self, frame):
return frame
......@@ -28,12 +31,13 @@ class Extension(object):
return frame
class Deflate(Extension):
class DeflateFrame(Extension):
name = 'deflate-frame'
rsv1 = True
parameters = ['max_window_bits', 'no_context_takeover']
def __init__(self, **kwargs):
super(Deflate, self).__init__(**kwargs)
super(DeflateFrame, self).__init__(**kwargs)
self.max_window_bits = int(self.max_window_bits)
def hook_send(self, frame):
......@@ -54,6 +58,9 @@ class Deflate(Extension):
return frame
def client_params(self):
raise NotImplementedError # TODO
def encode(self, data):
raise NotImplementedError # TODO
......@@ -61,7 +68,7 @@ class Deflate(Extension):
raise NotImplementedError # TODO
def filter_compatible(extensions):
def filter_extensions(extensions):
"""
Remove extensions that use conflicting rsv bits and/or opcodes, with the
first options being most preferable.
......
......@@ -41,7 +41,7 @@ class websocket(object):
`protocols` is a list of supported protocol names.
`extensions` is a list of supported extensions.
`extensions` is a list of supported extension classes.
`origin` (for client sockets) is the value for the "Origin" header sent
in a client handshake .
......
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