SPDY“Hello world”会是什么?看起来像?

发布于 2024-11-14 05:54:52 字数 334 浏览 3 评论 0原文

我刚刚浏览完 SPDY 白皮书,现在我有兴趣尝试一下。据我所知,Google 正在使用 SPDY 通过 SSL 向 Chrome 提供内容

通过 SPDY 设置和提供基本“Hello world”HTML 页面的最简单方法是什么?

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

错爱 2024-11-21 05:54:52

运行现有的 spdy 服务器,例如:

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

Run an existing spdy server such as:

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

隔纱相望 2024-11-21 05:54:52

最快、最简单的方法似乎是遵循此处的说明

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

梦醒灬来后我 2024-11-21 05:54:52

我用 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()

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()
涙—继续流 2024-11-21 05:54:52

SPDY 的目的是它对您的 Web 应用程序完全透明。您不需要编写代码来使用 SPDY,您只需要使用支持它的网络服务器即可。

如果您有一个 Java Web 应用程序,那么您可以使用 Jetty 启用 SPDY。 3 个简单步骤:将 jar 添加到启动路径以启用 NPN、为您的服务器创建 SSL 证书、将 SPDY 配置为连接器类型。请参阅 http://wiki.eclipse.org/Jetty/Feature/SPDY

这将是Jetty-9 更容易

The intention of SPDY is that it is entirely transparent to your webapplication. You don't need to write code to use SPDY, you just need to use a webserver that supports it.

If you have a java web application, then you can SPDY enable it by using Jetty. 3 simple steps: add a jar to the boot path to enable NPN, create an SSL certificate for your server, configure SPDY as the connector type. See http://wiki.eclipse.org/Jetty/Feature/SPDY

This will be even easier in Jetty-9

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文