]> git.ipfire.org Git - thirdparty/squid.git/commit - src/ssl/ErrorDetailManager.cc
Support logformat %codes in error page templates (#365) M-staged-PR365
authorChristos Tsantilas <christos@chtsanti.net>
Mon, 4 Mar 2019 12:43:27 +0000 (12:43 +0000)
committerSquid Anubis <squid-anubis@squid-cache.org>
Tue, 5 Mar 2019 14:43:48 +0000 (14:43 +0000)
commit7e6eabbc6976f939079e2abbbc52c2a98d65bd89
treed7f9c48292f760ce7b26ce0b5dabbe9638f1dc54
parent02ba667bd1199da8eb7a210eb50c577bd670d217
Support logformat %codes in error page templates (#365)

... using `@Squid{%code}` syntax which allows Squid to distinguish newly
supported logformat %codes like `%http::<rm` from classic single-letter
error page %codes like `%M` (that are never enclosed in `@Squid{}`).

This improvement gives error pages access to more information about the
failed transaction and paves the way towards unifying the two partially
duplicated %code interfaces (and underlying code).

Some single-letter error page %codes have similar logformat %codes. For
example, error page `%i` will often be replaced with the same characters
as `@Squid{%>a}`. However, admins should not rely on expansion
equivalence because most codes may be rendered differently under some
conditions, and the two rendering algorithms are not kept in sync. For
example, error page `%i` does not account for log_uses_indirect_client.

Only a few letters remain unused by the error page %codes. Most
(possibly all) new codes should be added to the logformat instead,
within an appropriate error_page:: namespace if needed.

Side effects of updating error page parsing and assembly code include:

* Leave bad %codes in deny_info URLs instead of removing them. This
  helps in triage and is consistent with how bad %codes are already
  handled in error pages.

* Report bad deny_info %codes at startup and reconfiguration. Startup
  errors should eventually become fatal, just like logformat errors are.

* Report bad error page %codes at startup and reconfiguration (except
  for `%;` sequences found in all existing error pages templates).

* Fixed parsing of non-default error-details.txt that did not end with
  an empty line.

* Fixed unterminated c-string printing when reporting error-details.txt
  parsing problems.

* Upgraded MsgBody to use SBuf.

This is a Measurement Factory project.
40 files changed:
src/CacheManager.h
src/ConfigParser.cc
src/ConfigParser.h
src/FwdState.cc
src/HttpBody.cc
src/HttpBody.h
src/acl/AclDenyInfoList.h
src/acl/Gadgets.cc
src/cache_manager.cc
src/client_side.cc
src/client_side_reply.cc
src/client_side_request.cc
src/clients/Client.cc
src/clients/FtpClient.cc
src/clients/FtpGateway.cc
src/errorpage.cc
src/errorpage.h
src/esi/Esi.cc
src/format/Format.cc
src/format/Format.h
src/format/Token.cc
src/gopher.cc
src/http.cc
src/internal.cc
src/internal.h
src/log/Makefile.am
src/log/forward.h [new file with mode: 0644]
src/mgr/Forwarder.cc
src/mgr/Forwarder.h
src/mgr/Inquirer.cc
src/peer_select.cc
src/security/PeerConnector.cc
src/ssl/ErrorDetail.cc
src/ssl/ErrorDetailManager.cc
src/tests/stub_cache_manager.cc
src/tests/stub_errorpage.cc
src/tunnel.cc
src/urn.cc
src/urn.h
src/whois.cc