How to determine HTTP response header size?

I want to determine the size of the response header. I suppose I can do this by subtracting the response body size from the combined size obtained using Chrome DevTools.

From Chrome DevTools :

Size is the combined size of the response headers (typically a few 100 bytes) plus the response body sent by the server.

The uncompressed .js file size is 375 bytes specified by Content . The combined size specified by DevTools is 701 bytes.

In addition, I have the following information from the Apache access log for recording the transfer of the same .js file:

 %b = 273 bytes (Size of response in bytes, excluding HTTP headers) %O = 842 bytes (Bytes sent, including headers, cannot be zero) 

Should I use %0 - %b , %0 - Content , Size - %b or Size - Content ? In addition, if anyone can tell me why there's a difference between %0 and size ?

+6
source share
2 answers

I don’t know which tool you need, but it is easy to calculate it in the shell using the curl function, assuming you have the following header:

 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 

to count:

 root@sup ~# curl -s -w \%{size_header} -o /dev/null http://domain.com 215 

result: 215 bytes.

+11
source

Logging % O in Apache includes any SSL overhead, so you actually have SSL bytes + header_bytes + compress_content, while Chrome Size only has base_byte + compressed_content. And to make it difficult, Chrome content is the size of the uncompressed content.

Based on your metrics, I say that on the network you have 261 bytes of headers + 273 bytes of compressed content + 308 bytes of SSL bytes, and Chrome will only tell you that the uncompressed size of the content makes it impossible to determine the size of the headers only from the data available in Chrome

0
source

Source: https://habr.com/ru/post/959212/


All Articles