如何使用内容编码:gzip与Python SimpleHTTPServer [英] How to use Content-Encoding: gzip with Python SimpleHTTPServer

查看:109
本文介绍了如何使用内容编码:gzip与Python SimpleHTTPServer的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用python -m SimpleHTTPServer来提供用于在Web浏览器中进行本地测试的目录.其中一些内容包括大型数据文件.我希望能够对它们进行gzip压缩,并让SimpleHTTPServer通过Content-Encoding:gzip为它们提供服务.

I'm using python -m SimpleHTTPServer to serve up a directory for local testing in a web browser. Some of the content includes large data files. I would like to be able to gzip them and have SimpleHTTPServer serve them with Content-Encoding: gzip.

有一种简单的方法吗?

推荐答案

由于这是Google的最佳搜索结果,因此我认为我会对对gzip起作用的脚本进行简单的修改.

Since this was the top google result I figured I would post my simple modification to the script that got gzip to work.

https://github.com/ksmith97/GzipSimpleHTTPServer

这篇关于如何使用内容编码:gzip与Python SimpleHTTPServer的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆