Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
W
wspy
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Taddeüs Kroes
wspy
Commits
2963b26e
Commit
2963b26e
authored
Aug 22, 2013
by
Taddeüs Kroes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added DeflateFrame to test server, some bugfixes to fully enable extensions
parent
6ec710a5
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
10 deletions
+15
-10
extension.py
extension.py
+5
-5
handshake.py
handshake.py
+4
-4
test/server.py
test/server.py
+6
-1
No files found.
extension.py
View file @
2963b26e
...
@@ -74,7 +74,7 @@ class DeflateFrame(Extension):
...
@@ -74,7 +74,7 @@ class DeflateFrame(Extension):
if
cto
is
not
False
and
cto
is
not
True
:
if
cto
is
not
False
and
cto
is
not
True
:
raise
ValueError
(
'"no_context_takeover" must have no value'
)
raise
ValueError
(
'"no_context_takeover" must have no value'
)
class
Hook
:
class
Hook
(
Extension
.
Hook
)
:
def
send
(
self
,
frame
):
def
send
(
self
,
frame
):
if
not
frame
.
rsv1
:
if
not
frame
.
rsv1
:
frame
.
rsv1
=
True
frame
.
rsv1
=
True
...
@@ -116,7 +116,7 @@ class Multiplex(Extension):
...
@@ -116,7 +116,7 @@ class Multiplex(Extension):
# TODO: check "quota" value
# TODO: check "quota" value
class
Hook
:
class
Hook
(
Extension
.
Hook
)
:
def
send
(
self
,
frame
):
def
send
(
self
,
frame
):
raise
NotImplementedError
# TODO
raise
NotImplementedError
# TODO
...
@@ -129,9 +129,9 @@ def filter_extensions(extensions):
...
@@ -129,9 +129,9 @@ def filter_extensions(extensions):
Remove extensions that use conflicting rsv bits and/or opcodes, with the
Remove extensions that use conflicting rsv bits and/or opcodes, with the
first options being the most preferable.
first options being the most preferable.
"""
"""
rsv1_reserved
=
Tru
e
rsv1_reserved
=
Fals
e
rsv2_reserved
=
Tru
e
rsv2_reserved
=
Fals
e
rsv3_reserved
=
Tru
e
rsv3_reserved
=
Fals
e
opcodes_reserved
=
[]
opcodes_reserved
=
[]
compat
=
[]
compat
=
[]
...
...
handshake.py
View file @
2963b26e
...
@@ -119,12 +119,12 @@ class ServerHandshake(Handshake):
...
@@ -119,12 +119,12 @@ class ServerHandshake(Handshake):
# Origin must be present if browser client, and must match the list of
# Origin must be present if browser client, and must match the list of
# trusted origins
# 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'
)
origin
=
headers
.
get
(
'Origin'
,
'null'
)
if
origin
==
'null'
:
if
origin
==
'null'
:
if
'User-Agent'
in
headers
:
self
.
fail
(
'browser client must specify "Origin" header'
)
if
ssock
.
trusted_origins
:
if
ssock
.
trusted_origins
:
self
.
fail
(
'no "Origin" header specified, assuming untrusted'
)
self
.
fail
(
'no "Origin" header specified, assuming untrusted'
)
elif
ssock
.
trusted_origins
and
origin
not
in
ssock
.
trusted_origins
:
elif
ssock
.
trusted_origins
and
origin
not
in
ssock
.
trusted_origins
:
...
@@ -390,7 +390,7 @@ def parse_param_hdr(hdr):
...
@@ -390,7 +390,7 @@ def parse_param_hdr(hdr):
params
[
key
]
=
value
params
[
key
]
=
value
yield
name
,
params
return
name
,
params
def
format_param_hdr
(
value
,
params
):
def
format_param_hdr
(
value
,
params
):
...
...
test/server.py
View file @
2963b26e
...
@@ -7,6 +7,7 @@ basepath = abspath(dirname(abspath(__file__)) + '/..')
...
@@ -7,6 +7,7 @@ basepath = abspath(dirname(abspath(__file__)) + '/..')
sys
.
path
.
insert
(
0
,
basepath
)
sys
.
path
.
insert
(
0
,
basepath
)
from
server
import
Server
from
server
import
Server
from
extension
import
DeflateFrame
class
EchoServer
(
Server
):
class
EchoServer
(
Server
):
...
@@ -15,7 +16,11 @@ class EchoServer(Server):
...
@@ -15,7 +16,11 @@ class EchoServer(Server):
client
.
send
(
message
)
client
.
send
(
message
)
class
WebkitDeflateFrame
(
DeflateFrame
):
name
=
'x-webkit-deflate-frame'
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
EchoServer
((
'localhost'
,
8000
),
EchoServer
((
'localhost'
,
8000
),
extensions
=
[
WebkitDeflateFrame
()],
#ssl_args=dict(keyfile='cert.pem', certfile='cert.pem'),
#ssl_args=dict(keyfile='cert.pem', certfile='cert.pem'),
loglevel
=
logging
.
DEBUG
).
run
()
loglevel
=
logging
.
DEBUG
).
run
()
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment