apache bench keep alive 的文档长度为 0

apache bench keep alive got 0 document length

我使用了以下命令: ab -k -n 1 -c 1 -v 5 $URL 得到:

LOG: header received:
Blockquote

HTTP/1.1 200 OK

content-length: 228

content-type: application/octet-stream
date: Fri, 26 Feb 2016 03:09:27 GMT
expires: Fri, 26 Feb 2016 03:10:27 GMT
cache-control: private, max-age=60
last-modified: Thu, 18 Feb 2016 07:02:46 GMT
connection: keep-alive`


LOG: Response code = 200
..done

...

Document Length:        0 bytes

Concurrency Level:      1
Time taken for tests:   0.019 seconds
Complete requests:      1
Failed requests:        0
Write errors:           0
Keep-Alive requests:    1
Total transferred:      263 bytes
HTML transferred:       0 bytes
Requests per second:    52.44 [#/sec] (mean)
Time per request:       19.068 [ms] (mean)
Time per request:       19.068 [ms] (mean, across all concurrent requests)
Transfer rate:          13.47 [Kbytes/sec] received

ab 收到了 header: content-length: 228,但是 Document Length 是 0 个字节。 卷曲 $URL 工作正常并获得 228 个字节。 那么它有什么问题呢?谢谢!

事实证明这是一个 ApacheBench 错误,它不接受小写 content-length header。