Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What would a SPDY "Hello world" look like?

I just finished skimming the SPDY white paper and now I'm interested in trying it out. I understand that Google is serving content over SSL to Chrome using SPDY.

What's the easiest way to set up and serve a basic "Hello world" HTML page over SPDY?

like image 614
Marcel Avatar asked Jun 06 '11 14:06

Marcel


3 Answers

Run an existing spdy server such as:

https://github.com/indutny/node-spdy

like image 166
Mark Avatar answered Nov 05 '22 22:11

Mark


It would seem that the quickest and easiest way would be to follow the instructions located here.

like image 34
Iiridayn Avatar answered Nov 05 '22 22:11

Iiridayn


I wrote spdylay SPDY library in C and recently added Python wrapper python-spdylay. It needs Python 3.3.0 (which is RC1 at the time of this writing), but you can write simple SPDY server just like this:

#!/usr/bin/env python
import spdylay

# private key file
KEY_FILE='server.key'
# certificate file
CERT_FILE='server.crt'

class MySPDYRequestHandler(spdylay.BaseSPDYRequestHandler):

    def do_GET(self):
        self.send_response(200)
        self.send_header('content-type', 'text/html; charset=UTF-8')

        content = '''\
<html><head><title>SPDY</title></head><body><h1>Hello World</h1>
</body></html>'''.encode('UTF-8')

        self.wfile.write(content)

if __name__ == "__main__":
    HOST, PORT = "localhost", 3000

    server = spdylay.ThreadedSPDYServer((HOST, PORT),
                                        MySPDYRequestHandler,
                                        cert_file=CERT_FILE,
                                        key_file=KEY_FILE)
    server.start()
like image 1
Tatsuhiro Tsujikawa Avatar answered Nov 05 '22 20:11

Tatsuhiro Tsujikawa