【发布时间】:2011-09-09 08:39:54
【问题描述】:
我刚刚浏览完SPDY white paper,现在我有兴趣尝试一下。我明白Google is serving content over SSL to Chrome using SPDY。
在 SPDY 上设置和提供基本的“Hello world”HTML 页面的最简单方法是什么?
【问题讨论】:
标签: optimization spdy
我刚刚浏览完SPDY white paper,现在我有兴趣尝试一下。我明白Google is serving content over SSL to Chrome using SPDY。
在 SPDY 上设置和提供基本的“Hello world”HTML 页面的最简单方法是什么?
【问题讨论】:
标签: optimization spdy
运行现有的 spdy 服务器,例如:
【讨论】:
似乎最快和最简单的方法是关注instructions located here。
【讨论】:
我用 C 语言编写了spdylay SPDY 库,最近添加了 Python 包装器 python-spdylay。 它需要 Python 3.3.0(在撰写本文时为 RC1), 但是您可以像这样编写简单的 SPDY 服务器:
#!/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()
【讨论】:
SPDY 的目的是它对您的 Web 应用程序完全透明。您无需编写代码即可使用 SPDY,只需使用支持它的网络服务器即可。
如果您有一个 java web 应用程序,那么您可以使用 Jetty 启用 SPDY。 3 个简单步骤:将 jar 添加到启动路径以启用 NPN,为您的服务器创建 SSL 证书,将 SPDY 配置为连接器类型。见http://wiki.eclipse.org/Jetty/Feature/SPDY
这在 Jetty-9 中会更容易
【讨论】: