]> git.ipfire.org Git - thirdparty/squid.git/commit
Fix %>ru logging of huge URLs (#259)
authorEduard Bagdasaryan <eduard.bagdasaryan@measurement-factory.com>
Fri, 20 Jul 2018 22:01:17 +0000 (01:01 +0300)
committerAmos Jeffries <yadij@users.noreply.github.com>
Sat, 21 Jul 2018 12:22:31 +0000 (00:22 +1200)
commitfbbd5cd5777205643027a444360deeea84d36f7e
treece7f5489e84ca72a089da11eaa3c48dab23b9e30
parentd3acc493b1431bcff9665978edf5bdd6ee49458d
Fix %>ru logging of huge URLs (#259)

When dealing with an HTTP request header that Squid can parse but that
contains request URI length exceeding the 8K limit, Squid should log the
URL (prefix) instead of a dash. Logging the URL helps with triaging
these unusual requests. The older %ru (LFT_REQUEST_URI) was already
logging these huge URLs, but %>ru (LFT_CLIENT_REQ_URI) was logging a
dash. Now both log the URL (or its prefix).

As a side effect, %>ru now also logs error:request-too-large,
error:transaction-end-before-headers and other Squid-specific
pseudo-URLs, as appropriate.

Also refactored request- and URI-recording code to reduce chances of
similar inconsistencies reappearing in the future.

Also, honor strip_query_terms in %ru for large URLs. Not stripping query
string in %ru was a security problem.

Also fixed a bug with "redirected" flag calculation in
ClientHttpRequest::handleAdaptedHeader(). In general, http->url and
request->url should not be compared directly, because the latter always
passes through uri_whitespace cleanup, while the former does not.

Also fixed a bug with possibly wrong %ru after redirection:
ClientHttpRequest::log_uri was not updated in this case.

Also initialize AccessLogEntry::request and AccessLogEntry::notes ASAP.
Before this change, these fields were initialized in
ClientHttpRequest::doCallouts(). It is better to initialize them just
after the request object is created so that ACLs, running before
doCallouts(), could have them at hand. There are at least three such
ACLs: force_request_body_continuation, spoof_client_ip and
spoof_client_ip.

Also synced %ru and %>ru documentation with the current code.

This is a v4 port of master bec110e.
22 files changed:
src/AccessLogEntry.cc
src/AccessLogEntry.h
src/Downloader.cc
src/HttpRequest.cc
src/HttpRequest.h
src/Makefile.am
src/anyp/Uri.cc
src/anyp/Uri.h
src/cf.data.pre
src/client_side.cc
src/client_side.h
src/client_side_reply.cc
src/client_side_request.cc
src/client_side_request.h
src/comm/TcpAcceptor.cc
src/format/Format.cc
src/htcp.cc
src/icp_v2.cc
src/servers/FtpServer.cc
src/servers/Http1Server.cc
src/tests/stub_client_side.cc
src/tests/stub_libanyp.cc