[squid-dev] [PATCH] VIA creation code duplication

Amos Jeffries squid3 at treenet.co.nz
Thu Feb 9 17:19:13 UTC 2017


On 3/02/2017 4:02 a.m., Eduard Bagdasaryan wrote:
> Hello,
> 
> This patch fixes VIA appending code duplication, moving common
> code into a separate method.
> 

Since Via is a list header we should be able to just append a new Via
header to the header list with putStr. No need to use getList, String,
delById to inject on the end of existing Via string.

Please also take the opportunity to fix a long standing protocol
violation bug in Via header produced by Squid:
 The version part of the header is only supposed to elide the protocol
label if the that label would be "HTTP/" (ie. for messages received via
HTTP and HTTPS).

eg. for ICY replies:
  Via: ICY/1.1 squid

eg. for FTP gatewayed replies (or relayed requests):
  Via: FTP/2 squid


After those calls that require String are gone please assemble the value
in an SBuf instead of static char* buffer.

Also, for messages where Squid itself generated the message (ie
Downloader or ESI) there should be no Via header added at all.

Amos



More information about the squid-dev mailing list