Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
shrapnel
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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
shrapnel
Commits
5a18f3b2
Commit
5a18f3b2
authored
Apr 18, 2013
by
Sam Rushing
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
short spdy/3 demos
parent
922e706b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
52 additions
and
0 deletions
+52
-0
coro/http/demo/spdy_client.py
coro/http/demo/spdy_client.py
+34
-0
coro/http/demo/spdy_server.py
coro/http/demo/spdy_server.py
+18
-0
No files found.
coro/http/demo/spdy_client.py
0 → 100644
View file @
5a18f3b2
# -*- Mode: Python -*-
import
coro
import
coro.backdoor
import
coro.ssl
from
coro.http.spdy
import
spdy_client
from
coro.http.protocol
import
header_set
W
=
coro
.
write_stderr
ctx
=
coro
.
ssl
.
new_ctx
(
#cert=coro.ssl.x509 (open ('cert/server.crt').read()),
#key=coro.ssl.pkey (open ('cert/server.key').read(), '', True),
next_protos
=
[
'spdy/2'
,
'http/1.1'
],
proto
=
'tlsv1'
,
)
def
t0
():
global
ctx
,
s
,
c
#ctx = coro.ssl.new_ctx (proto='tlsv1', next_protos=['spdy/2', 'http/1.1'])
s
=
coro
.
ssl
.
sock
(
ctx
)
c
=
spdy_client
(
'127.0.0.1'
,
9443
,
s
)
W
(
'negotiated: %r
\
n
'
%
(
s
.
ssl
.
get_next_protos_negotiated
(),))
h
=
header_set
()
req
=
c
.
send_request
(
'GET'
,
'/status'
,
h
,
content
=
None
,
force
=
True
)
req
.
wait
()
W
(
'%s
\
n
'
%
(
req
.
response
,))
print
repr
(
req
.
rfile
.
read
())
return
req
if
__name__
==
'__main__'
:
coro
.
spawn
(
coro
.
backdoor
.
serve
,
unix_path
=
'/tmp/spdy_client.bd'
)
coro
.
event_loop
(
30.0
)
coro/http/demo/spdy_server.py
0 → 100644
View file @
5a18f3b2
import
coro
import
coro.ssl
import
coro.http.spdy
import
coro.backdoor
ctx
=
coro
.
ssl
.
new_ctx
(
cert
=
coro
.
ssl
.
x509
(
open
(
'cert/server.crt'
).
read
()),
key
=
coro
.
ssl
.
pkey
(
open
(
'cert/server.key'
).
read
(),
''
,
True
),
next_protos
=
[
'spdy/3'
,
'http/1.1'
],
proto
=
'tlsv1'
,
)
server
=
coro
.
http
.
spdy
.
spdy_openssl_server
(
ctx
)
server
.
push_handler
(
coro
.
http
.
handlers
.
favicon_handler
())
server
.
push_handler
(
coro
.
http
.
handlers
.
coro_status_handler
())
coro
.
spawn
(
server
.
start
,
(
'0.0.0.0'
,
9443
))
coro
.
spawn
(
coro
.
backdoor
.
serve
,
unix_path
=
'/tmp/spdys.bd'
)
coro
.
event_loop
(
30.0
)
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