• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

bdarnell/tornado_http2

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称:

bdarnell/tornado_http2

开源软件地址:

https://github.com/bdarnell/tornado_http2

开源编程语言:

Python 100.0%

开源软件介绍:

tornado_http2

This package contains an HTTP/2 client and server implementation for Tornado. It is currently under development and interfaces are subject to change.

Installation

pip install git+https://github.com/bdarnell/tornado_http2.git

This package has only been tested with Tornado 4.5 on Python 2.7.10+ and 3.5.

Server-side usage

Two server classes are provided:

  • tornado_http2.server.Server only supports HTTP/2 over HTTPS connections and will use HTTP/1 for all unencrypted connections.
  • tornado_http2.server.CleartextHTTP2Server supports HTTP/2 for both HTTP and HTTPS connections. Note that most browsers will only use HTTP/2 over HTTPS, and CleartextHTTP2Server is a little slower than a regular Server, so it is mainly provided for testing purposes.

Both server classes can be used in two different ways: either instantiate them directly in place of a tornado.httpserver.HTTPServer:

server = tornado_http2.server.Server(app, ssl_options=...)
server.listen(...)

Or use HTTPServer.configure to change all HTTPServers in the process, including those created by methods like Application.listen or AsyncHTTPTestCase:

tornado.httpserver.HTTPServer.configure('tornado_http2.server.Server')
app.listen(...)

Client-side usage

Three client classes are provided:

  • tornado_http2.client.Client only supports HTTP/2 over HTTPS and will use HTTP/1 for all unencrypted connections.
  • tornado_http2.client.ForceHTTP2Client only supports HTTP/2 and will use it for both HTTP and HTTPS. Since it cannot talk to HTTP/1 servers, it is mainly for testing purposes.
  • tornado_http2.curl.CurlAsyncHTTP2Client requires a version of libcurl that is compiled with HTTP/2 support, and supports HTTP/2 over both HTTP and HTTPS, falling back to HTTP/1 when HTTP/2 is unsupported.

Both client classes can be used in two different ways: either instantiate them directly in place of a tornado.httpclient.AsyncHTTPClient (be careful with AsyncHTTPClient's instance-sharing magic):

client = tornado_http2.client.Client(force_instance=True)

Or use AsyncHTTPClient.configure to change all AsyncHTTPClients in the process:

tornado.httpclient.AsyncHTTPClient.configure('tornado_http2.client.Client')



鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap