我想确定响应头的大小.我假设我可以通过从使用Chrome DevTools派生的组合大小中减去响应主体的大小来实现.
来自Chrome DevTools:
Size是响应头的组合大小(通常为几百个字节)加上响应主体,由服务器提供.
.js文件的未压缩大小为375字节,由Content
.将合并size
由DevTools给定为701个字节.
另外,我从Apache访问日志中获得以下信息来记录相同.js文件的传输:
%b = 273 bytes (Size of response in bytes, excluding HTTP headers) %O = 842 bytes (Bytes sent, including headers, cannot be zero)
我应该使用%0 - %b
,%0 - Content
,Size - %b
或Size - Content
?另外,谁能告诉我为什么%0
和之间存在差异Size
?
我不知道你需要什么工具,但是使用curl实用程序很容易计算shell,假设你有以下标题:
root@sup ~# curl -I http://domain.com HTTP/1.1 200 OK Server: nginx/1.2.1 Date: Thu, 05 Dec 2013 19:40:40 GMT Content-Type: text/html Content-Length: 199 Last-Modified: Sun, 15 Sep 2013 17:06:37 GMT Connection: keep-alive Accept-Ranges: bytes
算一算:
root@sup ~# curl -s -w \%{size_header} -o /dev/null http://domain.com 215
结果:215个字节.