[squid-users] How to get the correct size of a denied object ?

Amos Jeffries squid3 at treenet.co.nz
Mon Jul 20 18:58:32 UTC 2015


On 21/07/2015 5:51 a.m., Stakres wrote:
> Amos,
> How do you get the real size at the moment with a normal object ?
> Just do the same 
> I suppose you get the size from the headers, right ?
> 

The log contains the bytes *delivered to the client*.
When accounting bandwidth only the actual transfer sizes matter.


> If we know the object is denied, we ask for a head request to know the size
> and we use it in the log.
> As the object will be blocked, we don't care this action will need 3 sec or
> more, the user will not get the object...
> See what I mean ?

I know what you mean. HTTP does not work that way.


GET / HTTP/1.0
Host: example.com
User-Agent: squidclient/3.5.5
Accept: */*
Connection: close

HTTP/1.1 200 OK
Date: Mon, 20 Jul 2015 18:29:02 GMT
Server: Apache/2.4.12 (Debian)
Vary: Accept-Encoding
Content-Length: 747
Connection: close
Content-Type: text/html;charset=UTF-8


GET / HTTP/1.0
Host: example.com
User-Agent: squidclient/3.5.5
Accept: */*
Connection: close
Accept-Encoding:gzip

HTTP/1.1 200 OK
Date: Mon, 20 Jul 2015 18:30:38 GMT
Server: Apache/2.4.12 (Debian)
Vary: Accept-Encoding
Content-Encoding: gzip
Content-Length: 405
Connection: close
Content-Type: text/html;charset=UTF-8


What the server was actually sending?

HEAD / HTTP/1.0
Host: example.com
User-Agent: squidclient/3.5.5
Accept: */*
Connection: close

HTTP/1.1 200 OK
Date: Mon, 20 Jul 2015 18:29:49 GMT
Server: Apache/2.4.12 (Debian)
Connection: close
Content-Type: text/html;charset=UTF-8


Amos



More information about the squid-users mailing list