Permalink
Browse files

various fixes in test/spdyserver.py

  • Loading branch information...
1 parent 2e131f0 commit 5171c8d6088a8eb2e408ac20af1beb46d97205bd @colinmarc committed May 2, 2012
Showing with 9 additions and 9 deletions.
  1. +9 −9 test/spdyserver.py
View
@@ -1,41 +1,41 @@
import socket
import ssl
import spdy.frames
-from spdy.connection import *
+import spdy
from pprint import pprint
server = socket.socket()
server.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
server.bind(('', 9599))
server.listen(5)
-ctx = ssl.SSLContext(ssl.PROTOCOL_TLSv1)
+ctx = ssl.SSLContext(ssl.PROTOCOL_SSLv23)
ctx.load_cert_chain('server.crt', 'server.key')
ctx.set_npn_protocols(['spdy/2'])
def handle_frame(conn, f):
- print("server says,", f)
+ print("CLIENT SAYS,", f)
if isinstance(f, spdy.frames.Ping):
ping = spdy.frames.Ping(f.uniq_id)
conn.put_frame(ping)
- print(ping, "says client")
+ print(str(ping) + ", SAYS SERVER")
+
elif isinstance(f, spdy.frames.SynStream):
- pprint(f.headers)
resp = spdy.frames.SynReply(f.stream_id, {'status': '200 OK', 'version': 'HTTP/1.1'}, flags=0)
conn.put_frame(resp)
- print(resp, "says client")
- data = spdy.frames.DataFrame(f.stream_id, b"hello world!!!", flags=1)
+ print(str(resp) + ", SAYS SERVER")
+ data = spdy.frames.DataFrame(f.stream_id, b"hello, world!", flags=1)
conn.put_frame(data)
- print(data, "says client")
+ print(str(data) + ", SAYS SERVER")
try:
while True:
try:
sock, sockaddr = server.accept()
ss = ctx.wrap_socket(sock, server_side=True)
- conn = Connection(SERVER)
+ conn = spdy.Context(spdy.SERVER)
while True:
d = ss.recv(1024)

0 comments on commit 5171c8d

Please sign in to comment.