出于单元测试的目的,我想配置Apache来gzip一个静态文件,然后对其进行块编码并将其作为响应发送。到目前为止我试过了:
# Created a file httpd-deflate.conf
# Set to gzip all output
SetOutputFilter DEFLATE
#set compression level
DeflateCompressionLevel 9
# Deflate in chunks
DeflateBufferSize 100
在httpd.conf中包含此文件
Include httpd-deflate.conf
发送请求如下:
GET / HTTP/1.1
Host: test-server
Accept-Encoding: gzip
Connection: Keep-Alive
得到以下回复:
HTTP/1.1 200 OK
Date: Wed, 05 Nov 2014 19:24:23 GMT
Server: Apache/2.2.15 (Scientific Linux)
Last-Modified: Wed, 05 Nov 2014 18:17:21 GMT
ETag: "5e28c-5df-5072097390e40"
Accept-Ranges: bytes
Vary: Accept-Encoding
Content-Encoding: gzip
Content-Length: 1186
Connection: close
Content-Type: text/html; charset=UTF-8
<binary-data>
Apache有没有办法开始以分块格式发送gziped数据。我认为DeflateBufferSize可以帮助我做到这一点。然而,到目前为止没有运气。
有什么建议吗?
感谢。