]> git.ipfire.org Git - thirdparty/squid.git/log
thirdparty/squid.git
5 years agoSupport logformat %codes in error page templates (#365) M-staged-PR365
Christos Tsantilas [Mon, 4 Mar 2019 12:43:27 +0000 (12:43 +0000)] 
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.

5 years agoBug 4823: assertion failed: "lowestOffset () <= target_offset" (#370) M-staged-PR370
Eduard Bagdasaryan [Sun, 24 Feb 2019 21:25:25 +0000 (21:25 +0000)] 
Bug 4823: assertion failed: "lowestOffset () <= target_offset" (#370)

This assertion could be triggered by various swapout failures for
ufs/aufs/diskd cache_dir entries.

The bug was caused by 4310f8b change related to storeSwapOutFileClosed()
method. Before that change, swapout failures resulted in
StoreEntry::swap_status set to SWAPOUT_NONE, preventing
another/asserting iteration of StoreEntry::swapOut().

This fix adds SWAPOUT_FAILED swap status for marking swapout failures
(instead of reviving and abusing SWAPOUT_NONE), making the code more
reliable.

Also removed storeSwapOutFileNotify() implementation.  We should not
waste time on maintaining an unused method that now contains conflicting
assertions: swappingOut() and !hasDisk().

5 years agoFixed build after 36c774f (PROXY protocol TLVs improvements) (#376) M-staged-PR376
Alex Rousskov [Sun, 24 Feb 2019 12:55:18 +0000 (12:55 +0000)] 
Fixed build after 36c774f (PROXY protocol TLVs improvements) (#376)

5 years agoFixed build after a56fcf0 (Reuse helpers after timeout) (#375) M-staged-PR375
Alex Rousskov [Sun, 24 Feb 2019 09:54:44 +0000 (09:54 +0000)] 
Fixed build after a56fcf0 (Reuse helpers after timeout) (#375)

In all tested environments, something else #included `<map>`,
apparently, but that old explicit #include should not have been removed.

Also fixed STL #include order.

5 years agoMade Coverity happier after e863656 (timestamps for FATAL) (#374)
Alex Rousskov [Sun, 24 Feb 2019 09:01:53 +0000 (09:01 +0000)] 
Made Coverity happier after e863656 (timestamps for FATAL) (#374)

CID 1441976: Uninitialized scalar field (UNINIT_CTOR)

The forgotten stub data member is currently unused.

5 years agoFixed squidclient authentication after 4b19fa9 (Bug 4843 pt2) (#373) M-staged-PR373
Alex Rousskov [Sun, 24 Feb 2019 03:28:47 +0000 (03:28 +0000)] 
Fixed squidclient authentication after 4b19fa9 (Bug 4843 pt2) (#373)

* squidclient -U sent Proxy-Authorization instead of Authorization.
  Code duplication bites again.

* squidclient -U and -u could sent random garbage after the correct
  [Proxy-]Authorization value as exposed by Coverity CID 1441999: Unused
  value (UNUSED_VALUE). Coverity missed this deeper problem, but
  analyzing its report lead to discovery of the two bugs fixed here.

Also reduced authentication-related code duplication.

5 years agoMade Coverity happier after PROXY protocol TLVs improvements (#372) M-staged-PR372
Alex Rousskov [Sat, 23 Feb 2019 23:58:15 +0000 (23:58 +0000)] 
Made Coverity happier after PROXY protocol TLVs improvements (#372)

CID 1210957: Uninitialized scalar field (UNINIT_CTOR)

5 years agoMade Coverity happier after Bug 4864 fix (#371)
Alex Rousskov [Thu, 21 Feb 2019 21:56:48 +0000 (21:56 +0000)] 
Made Coverity happier after Bug 4864 fix (#371)

... by addressing the following false-positive:
CID 1442832: Null pointer dereferences (FORWARD_NULL)

The Comm::IsConnOpen() test guarantees that connManager is not nil. An
explicit assert() might reduce bugs when this code is refactored.

5 years agoFix stack-based buffer-overflow when parsing SNMP messages (#319) M-staged-PR319
flozilla [Tue, 19 Feb 2019 12:41:00 +0000 (12:41 +0000)] 
Fix stack-based buffer-overflow when parsing SNMP messages (#319)

Fortunately, this off-by-one bug seems to have no runtime effect.

5 years agoMaintenance 5 (#366) M-staged-PR366
squidadm [Mon, 18 Feb 2019 18:10:26 +0000 (18:10 +0000)] 
Maintenance 5 (#366)

5 years agoBug 4864: !Comm::MonitorsRead assertion in maybeReadVirginBody() (#351) M-staged-PR351
Christos Tsantilas [Fri, 15 Feb 2019 15:50:45 +0000 (15:50 +0000)] 
Bug 4864: !Comm::MonitorsRead assertion in maybeReadVirginBody() (#351)

This assertion is probably triggered when Squid retries/reforwards
server-first or step2+ bumped connections (after they fail).
Retrying/reforwarding such pinned connections is wrong because the
corresponding client-to-Squid TLS connection was negotiated based on the
now-failed Squid-to-server TLS connection, and there is no mechanism to
ensure that the new Squid-to-server TLS connection will have exactly the
same properties. Squid should forward the error to client instead.

Also fixed peer selection code that could return more than one PINNED
paths with only the first path having the destination of the actual
pinned connection. To reduce the chances of similar future bugs, and to
polish the code, peer selection now returns a nil path to indicate a
PINNED decision. After all, the selection code decides to use a pinned
connection (whatever it is) rather than a specific pinned _destination_.

This is a Measurement Factory project.

5 years agoLog PROXY protocol v2 TLVs; fix PROXY protocol parsing bugs (#342) M-staged-PR342
Eduard Bagdasaryan [Fri, 15 Feb 2019 00:17:41 +0000 (00:17 +0000)] 
Log PROXY protocol v2 TLVs; fix PROXY protocol parsing bugs (#342)

Added %proxy_protocol::>h logformat code for logging received PROXY
protocol TLV values and passing them to adaptation services and helpers.
For simplicity, this implementation treats TLV values as text and reuses
the existing HTTP header field logging interfaces. Support for binary
TLV value logging can be added later if needed.

Also support logging of metadata extracted from the fixed portion of a
PROXY protocol header and referenced as "pseudo headers": :command,
:version, :src_addr, :dst_addr, :src_port, and :dst_port.

Also fixed several bugs in the old PROXY protocol v1/v2 parsing code:

* Buffer overrun in ConnStateData::parseProxy2p0(). The available
  local SBuf could be less than sizeof(pax), resulting in copying
  excessive bytes with SBuf::rawContent().

* Incorrect processing of malformed v1 headers lacking CRLF in
  ConnStateData::parseProxy1p0(), which waited for more data
  even if the buffer size already exceeded the maximum v1 header
  size.

* Incorrect processing of partial-buffered v1 headers, when only
  the initial (magic) part of the header has been received. The old
  code resulted with an error instead of waiting for more data in this
  case.

* Incorrect v1 header framing for proto=UNKNOWN headers.
  The code used only LF while the protocol requires CRLF for it.

* Do not use address information from v2 header if the header
  proto is UNSPEC.

* Incorrect v1 magic expectations (a 6-character `PROXY ` instead of the
  proper 5-character `PROXY` sequence) leading to mishandling of
  non-PROXY input. For example, receiving `PROXY\r\n` would result in
  "need more data" outcome (and long timeout) instead of an immediate
  error.

Also eliminated code duplication in HttpHeader::getByNameListMember()
and HttpHeader::getListMember(), moving the common part into a
separate getListMember() method.

Also eliminated code duplication and probably fixed a bug with applying
client_netmask parameter in ConnStateData constructor. The mask should
not be applied to localhost and IPv6 addresses but was.

Also parse PROXY protocol v2 LOCAL addresses (for logging purposes). In
compliance with the PROXY protocol specs, LOCAL addresses are still
unused for connection routing.

5 years agoBug 4919: master commit b599471 leaks memory (#364) M-staged-PR364
Alex Rousskov [Thu, 14 Feb 2019 18:48:56 +0000 (18:48 +0000)] 
Bug 4919: master commit b599471 leaks memory (#364)

Restored the natural order of the following two notifications:
* BodyConsumer::noteMoreBodyDataAvailable() and
* BodyConsumer::noteBodyProductionEnded() or noteBodyProducerAborted().

Commit b599471 unintentionally reordered those two notifications. Client
kids (and possibly other BodyConsumers) relied on the natural order to
end their work. If an HttpStateData job was done with the Squid-to-peer
connection and only waiting for the last adapted body bytes, it would
get stuck and leak many objects. This use case was not tested during
b599471 work.

5 years agoReuse reserved Negotiate and NTLM helpers after an idle timeout (#59)
Christos Tsantilas [Tue, 12 Feb 2019 17:16:23 +0000 (17:16 +0000)] 
Reuse reserved Negotiate and NTLM helpers after an idle timeout (#59)

Squid can be killed or maimed by enough clients that start multi-step
connection authentication but never follow up with the second HTTP
request while keeping their HTTP connection open. Affected helpers
remain in the "reserved" state and cannot be reused for other clients.
Observed helper exhaustion has happened without any malicious intent.

To address the problem, we add a helper reservation timeout. Timed out
reserved helpers may be reused by new clients/connections. To minimize
problems with slow-to-resume-authentication clients, timed out reserved
helpers are not reused until there are no unreserved running helpers
left. The reservations are tracked using unique integer IDs.

Also fixed Squid crashes caused by unexpected helper termination -- the
raw UserRequest::authserver pointer could point to a deleted helper.

This is a Measurement Factory project.

5 years agoAdd support for buffer-size= to UDP logging (#359) M-staged-PR359
mahdi1001 [Sun, 10 Feb 2019 08:08:55 +0000 (08:08 +0000)] 
Add support for buffer-size= to UDP logging (#359)

Allow admin control of buffering for log outputs written to UDP
receivers using the buffer-size= parameter.

buffer-size=0byte disables buffering and sends UDP packets
immediately regardless of line size.

When non-0 values are used lines shorter than the buffer may be
delayed and aggregated into a later UDP packet.

Log lines larger than the buffer size will be sent immediately
and may trigger delivery of previously buffered content to
retain log order (at time of send, not UDP arrival).

To avoid truncation problems known with common recipients
the buffer size remains capped at 1400 bytes.

5 years agoPrep for 4.6 (#361)
Amos Jeffries [Fri, 8 Feb 2019 11:22:38 +0000 (00:22 +1300)] 
Prep for 4.6 (#361)

5 years agoSourceFormat Enforcement
SquidAdm [Sun, 27 Jan 2019 03:00:02 +0000 (03:00 +0000)] 
SourceFormat Enforcement

5 years agoSourceFormat Enforcement
SquidAdm [Tue, 1 Jan 2019 06:12:41 +0000 (06:12 +0000)] 
SourceFormat Enforcement

5 years agoSourceFormat Enforcement
SquidAdm [Tue, 1 Jan 2019 00:12:49 +0000 (00:12 +0000)] 
SourceFormat Enforcement

5 years agoCleanup and simplify unit tests (#336)
Amos Jeffries [Fri, 25 Jan 2019 16:21:38 +0000 (16:21 +0000)] 
Cleanup and simplify unit tests (#336)

Polish unit tests to reduce their dependency lists inline with
the updated test documentation requirements.

Some further cleanup of unit tests documentation based on
experience pruning existing unit tests.

 * Only the test logic files actually need to be distributed by
   a test. All files being tested are supposed to be distributed
   from elsewhere and the test should rely on that to prevent
   future issues like the base/RefCount.h bug mentioned below.

 * Starting to deprecate TESTSOURCES which is causing more
   trouble than benefit by pulling in too many needless
   dependencies. eg the globals.cc objects and symbols. Tools it
   used to provide are largely superseded by the stub mechanisms.

Add missing stub files necessary for pruning dependencies. Also
fix some bugs in existing stub files.

Fix base/RefCount.h distribution. This file was not included in
the base/libbase.la dependency list but indirectly being
distributed by the unit-test existence. Which in some builds
could cause it not to exist in generated minimal tarballs.

5 years agoBug 4915: Detect IPv6 loopback binding errors (#355)
Amos Jeffries [Thu, 24 Jan 2019 16:43:47 +0000 (16:43 +0000)] 
Bug 4915: Detect IPv6 loopback binding errors (#355)

Systems which have been partially 'IPv6 disabled' may allow
sockets to be opened and used but missing the IPv6 loopback
address.

Implement the outstanding TODO to detect such failures and
disable IPv6 support properly within Squid when they are found.

This should fix bug 4915 auth_param helper startup and similar
external_acl_type helper issues. For security such helpers are
not permitted to use the machine default IP address which is
globally accessible.

5 years agoBug 4914: Do not call setsid() in --foreground mode (#354)
Marcos Mello [Wed, 23 Jan 2019 15:18:43 +0000 (15:18 +0000)] 
Bug 4914: Do not call setsid() in --foreground mode (#354)

Squid executed in --foreground is always a process group leader. Thus,
setsid(2) is unnecessary and always fails (with EPERM) for such Squids.

5 years agoFail Rock swapout if the disk dropped some of the write requests (#352)
Eduard Bagdasaryan [Wed, 23 Jan 2019 04:30:40 +0000 (04:30 +0000)] 
Fail Rock swapout if the disk dropped some of the write requests (#352)

Detecting dropped writes earlier is more than a TODO: If the last entry
write was successful, the whole entry becomes available for hits
immediately.  IpcIoFile::checkTimeouts() that runs every 7 seconds
(IpcIoFile::Timeout) would eventually notify Rock about the timeout,
allowing Rock to release the failed entry, but that notification may
be too late.

The precise outcome of hitting an entry with a missing on-disk slice is
unknown (because the bug was detected by temporary hit validation code
that turned such hits into misses), but SWAPFAIL is the best we could
hope for.

5 years agoInitialize StoreMapSlice when reserving a new cache slot (#350)
Eduard Bagdasaryan [Wed, 23 Jan 2019 03:51:12 +0000 (03:51 +0000)] 
Initialize StoreMapSlice when reserving a new cache slot (#350)

Rock sets the StoreMapSlice::next field when sending a slice to disk. To
avoid writing slice A twice, Rock allocates a new slice B to prime
A.next right before writing A. Scheduling A's writing and, sometimes,
lack of data to fill B create a gap between B's allocation and B's
writing (which sets B.next). During that time, A.next points to B, but
B.next is untouched.

If writing slice A or swapout in general fails, the chain of failed
entry slices (now containing both A and B) is freed. If untouched B.next
contains garbage, then freeChainAt() adds "random" slices after B to the
free slice pool. Subsequent swapouts use those incorrectly freed slices,
effectively overwriting portions of random cache entries, corrupting the
cache.

How did B.next get dirty in the first place? freeChainAt() cleans the
slices it frees, but Rock also makes direct noteFreeMapSlice() calls.
Shared memory cache may have avoided this corruption because it makes no
such calls.

Ipc::StoreMap::prepFreeSlice() now clears allocated slices. Long-term,
we may be able to move free slice management into StoreMap to automate
this cleanup.

Also simplified and polished slot allocation code a little, removing the
Rock::IoState::reserveSlotForWriting() middleman. This change also
improves the symmetry between Rock and shared memory cache code.

5 years agoFixed disker-to-worker queue overflows (#353)
Eduard Bagdasaryan [Sat, 12 Jan 2019 10:05:30 +0000 (10:05 +0000)] 
Fixed disker-to-worker queue overflows (#353)

Before this fix, Squid sometimes logged the following error:

    BUG: Worker I/O pop queue for ... overflow: ...

The bug could result in truncated hit responses, reduced hit ratio, and,
combined with buggy lost I/O handling code (GitHub PR #352), even cache
corruption.

The bug could be triggered by the following sequence of events:

* Disker dequeues one I/O request from the worker push queue.
* Worker pushes more I/O requests to that disker, reaching 1024 requests
  in its push queue (QueueCapacity or just "N" below). No overflow here!
* Worker process is suspended (or is just too busy to pop I/O results).
* Disker satisfies all 1+N requests, adding each to the worker pop queue
  and overflows that queue when adding the last processed request.

This fix limits worker push so that the sum of all pending requests
never exceeds (pop) queue capacity. This approach will continue to work
even if diskers are enhanced to dequeue multiple requests for seek
optimization and/or priority-based scheduling.

Pop queue and push queue can still accommodate N requests each. The fix
appears to reduce supported disker "concurrency" levels from 2N down to
N pending I/O requests, reducing queue memory utilization. However, the
actual reduction is from N+1 to N: Since a worker pops all its satisfied
requests before queuing a new one, there could never be more than N+1
pending requests (N in the push queue and 1 worked on by the disker).

We left the BUG reporting and handling intact. There are no known bugs
in that code now. If the bug never surfaces again, it can be replaced
with code that translates low-level queue overflow exception into a
user-friendly TextException.

5 years agoFix OpenSSL builds that define OPENSSL_NO_ENGINE (#349)
Rosen Penev [Wed, 9 Jan 2019 17:42:21 +0000 (17:42 +0000)] 
Fix OpenSSL builds that define OPENSSL_NO_ENGINE (#349)

Even with ENGINE support disabled, OpenSSL provides the openssl/engine.h
header. We have to use OPENSSL_NO_ENGINE to detect ENGINE support.

5 years agoFix BodyPipe/Sink memory leaks associated with auto-consumption (#348) M-staged-PR348
Alex Rousskov [Tue, 8 Jan 2019 15:14:18 +0000 (15:14 +0000)] 
Fix BodyPipe/Sink memory leaks associated with auto-consumption (#348)

Auto-consumption happens (and could probably leak memory) in many cases,
but this leak was exposed by an eCAP service that blocked or replaced
virgin messages.

The BodySink job termination algorithm relies on body production
notifications. A BodySink job created after the body production had
ended can never stop and, hence, leaks (leaking the associated BodyPipe
object with it). Such a job is also useless:  If production is over,
there is no need to free space for more body data!  This change avoids
creating such leaking and useless jobs.

5 years agoBug 4856: Exit when GoIntoBackground() fork() call fails (#344)
Marcos Mello [Tue, 8 Jan 2019 10:14:09 +0000 (10:14 +0000)] 
Bug 4856: Exit when GoIntoBackground() fork() call fails (#344)

Ignoring the (implicit/default) command-line instruction to background
Squid is wrong in general and confuses at least some daemon managers.

5 years agoBug 4875 pt2: GCC-8 compile errors with -O3 optimization (#288)
Amos Jeffries [Sun, 6 Jan 2019 13:22:19 +0000 (13:22 +0000)] 
Bug 4875 pt2: GCC-8 compile errors with -O3 optimization (#288)

GCC-8 warnings exposed at -O3 optimization causes its
own static analyzer to detect optimized code is eliding
initialization on paths that do not use the
configuration variables.

Refactor the parseTimeLine() API to return the parsed
values so that there is no need to initialize anything prior
to parsing.

5 years agoTranslatons: Initial translation to ka/georgian language (#345) M-staged-PR345
George Machitidze [Sun, 6 Jan 2019 08:38:43 +0000 (08:38 +0000)] 
Translatons: Initial translation to ka/georgian language (#345)

5 years agobasic_ldap_auth: Return BH on internal errors; polished messages (#347)
Amish [Wed, 2 Jan 2019 11:51:45 +0000 (11:51 +0000)] 
basic_ldap_auth: Return BH on internal errors; polished messages (#347)

Basic LDAP auth helper now returns BH instead of ERR in case of errors
other than LDAP_SECURITY_ERROR, per helper guidelines.

Motivation: I have a wrapper around Basic LDAP auth helper. If an LDAP
server is down, then the helper returns BH, and the wrapper uses
a fallback authentication source.

Also converted printf() to SEND_*() macros and reduced message
verbosity.

5 years agoPrep for 4.5 (#343)
Amos Jeffries [Sat, 29 Dec 2018 22:20:34 +0000 (11:20 +1300)] 
Prep for 4.5 (#343)

5 years agoSquid crashes when ICAPS and a sslcrtvalidator used together (#328)
Christos Tsantilas [Tue, 25 Dec 2018 17:01:39 +0000 (17:01 +0000)] 
Squid crashes when ICAPS and a sslcrtvalidator used together (#328)

Squid hits an assertions when tries to remove an comm_close handler from
the already closed connection object.

This is a Measurement Factory project

5 years agoBug 4253: ssl_bump prevents from accessing some web contents (#304)
Christos Tsantilas [Tue, 25 Dec 2018 13:37:26 +0000 (13:37 +0000)] 
Bug 4253: ssl_bump prevents from accessing some web contents (#304)

Surrogate-Capability should only be sent on accel traffic, not
on bumped traffic.

This is a Measurement Factory project

5 years agoAdd %ssl::<cert macro for logging server X.509 certificate (#316)
Daris A Nevil [Mon, 17 Dec 2018 17:38:01 +0000 (17:38 +0000)] 
Add %ssl::<cert macro for logging server X.509 certificate (#316)

We have chosen the PEM format instead of, for example, raw DER format
because most programs exchange certificates using PEM format and because
logging raw binary values would be unusual for Squid logformat.

The current support is limited to SslBump step3 which parses and stores
the peer certificate. TODO: Support all from-Squid TLS connections.

5 years agoDocs: Improved lexgrog compatibility (#340)
uhliarik [Tue, 11 Dec 2018 23:09:46 +0000 (23:09 +0000)] 
Docs: Improved lexgrog compatibility (#340)

The generated url_lfs_reqwrite.8 manpage was not parsable by lexgrog:

    $ lexgrog url_lfs_rewrite.8.gz
    url_lfs_rewrite.8.gz: parse failed

5 years agoUse and prefer pkg-config when ./configure-ing libxml2 (#338)
Fabrice Fontaine [Tue, 4 Dec 2018 17:23:25 +0000 (17:23 +0000)] 
Use and prefer pkg-config when ./configure-ing libxml2 (#338)

The old method of trying to locate libxml2 via AC_CHECK_LIB() is
preserved to accommodate environments without pkg-config.

pkg-config knows about libxml2 dependencies like lz or -liconv that the
old method misses.

5 years agoFixed forward_max_tries documentation and implementation (#277)
Eduard Bagdasaryan [Wed, 28 Nov 2018 23:55:29 +0000 (23:55 +0000)] 
Fixed forward_max_tries documentation and implementation (#277)

Before 1c8f25b, FwdState::n_tries counted the total number of forwarding
attempts, including pinned and persistent connection retries. Since that
revision, it started counting just those retries. What should n_tries
count? The counter is used to honor the forward_max_tries directive, but
that directive was documented to limit the number of _different_ paths
to try. Neither 1c8f25b~1 nor 1c8f25b code matched that documentation!

Continuing to count just pinned and persistent connection retries (as in
1c8f25b) would violate any reasonable forward_max_tries intent and admin
expectations. There are two ways to fix this problem, synchronizing code
and documentation:

* Count just the attempts to use a different forwarding path, matching
  forward_max_tries documentation but not what Squid has ever done. This
  approach makes it difficult for an admin to limit the total number of
  forwarding attempts in environments where, say, the second attempt is
  unlikely to succeed and will just incur wasteful delays (Squid bug
  4788 report is probably about one of such use cases). Also,
  implementing this approach may be more difficult because it requires
  adding a new counter for retries and, for some interpretations of
  "different", even a container of previously visited paths.

* Count all forwarding attempts (as before 1c8f25b) and adjust
  forward_max_tries documentation to match this historical behavior.
  This approach does not have known unique flaws.

Also fixed FwdState::n_tries off-by-one comparison bug discussed during
Squid bug 4788 triage.

Also fixed admin concern behind Squid bug 4788 "forward_max_tries 1 does
not prevent some retries": While the old forward_max_tries documentation
actually excluded pconn retries, technically invalidating the bug
report, the admin now has a knob to limit those retries.

5 years agoMaintenance script updates (#334)
Amos Jeffries [Mon, 19 Nov 2018 12:35:39 +0000 (12:35 +0000)] 
Maintenance script updates (#334)

Fix/workaround some bugs and incorrect errors in the
source-maintenance script.

5 years agoCleanup: Use SBuf for peer Digest labels (#326)
Amos Jeffries [Mon, 19 Nov 2018 02:35:16 +0000 (02:35 +0000)] 
Cleanup: Use SBuf for peer Digest labels (#326)

... removing one more unnecessary use of String.

5 years agoSourceLayout: Cleanup unit tests (#324)
Amos Jeffries [Fri, 16 Nov 2018 06:04:45 +0000 (06:04 +0000)] 
SourceLayout: Cleanup unit tests (#324)

Polish up and add some structure to the unit tests in
src/Makefile.am. Documenting current best practice for new test
additions and shuffling of lines around to make the tests easily
managed in future, consistent with that practice.

There are two functional changes amongst the non-logic changes;

1) testUfs and testRock src/fs/ tests are updated to using
   automake conditionals to wrap the entire set of automake lists.
   Not just the part adding the test binary to those built. This
   reduces the compiler work creating dependency information for
   them in builds where they are not going to be used.

2) testRefCount has missing LDFLAGS list added

Also, shuffling of most SOURCES lists into nodist_*_SOURCES to
comply with the documented practice is left to followup work
pruning those lists down.

5 years agoMaintenance: add .xz tarball format formally to make dist (#325)
Amos Jeffries [Sun, 11 Nov 2018 04:29:58 +0000 (04:29 +0000)] 
Maintenance: add .xz tarball format formally to make dist (#325)

Automake can now handle generating this format itself and the
experiments of providing it for downstream have gone well.

5 years agoReplace AclNameList with SBufList (#327)
Amos Jeffries [Sun, 11 Nov 2018 00:01:56 +0000 (00:01 +0000)] 
Replace AclNameList with SBufList  (#327)

Removing a class we no longer need to simplify the deny_info code.

5 years agoFix netdb exchange with a TLS cache_peer (#307)
chi-mf [Tue, 30 Oct 2018 04:48:40 +0000 (04:48 +0000)] 
Fix netdb exchange with a TLS cache_peer (#307)

Squid uses http-scheme URLs when sending netdb exchange (and possibly
other) requests to a cache_peer. If a DIRECT path is selected for that
cache_peer URL, then Squid sends a clear text HTTP request to that
cache_peer. If that cache_peer expects a TLS connection, it will reject
that request (with, e.g., error:transaction-end-before-headers),
resulting in an HTTP 503 or 504 netdb fetch error.

Workaround this by adding an internalRemoteUri() parameter to indicate
whether https or http URL scheme should be used. Netdb fetches from
CachePeer::secure peers now get an https scheme and, hence, a TLS
connection.

5 years agoSource Format Enforcement (#317)
squidadm [Sun, 28 Oct 2018 00:10:27 +0000 (00:10 +0000)] 
Source Format Enforcement (#317)

5 years agoPrep for 4.4 (#320)
Amos Jeffries [Sat, 27 Oct 2018 20:02:52 +0000 (09:02 +1300)] 
Prep for 4.4 (#320)

5 years agoUpdate netdb when tunneling requests (#314) M-staged-PR314
chi-mf [Thu, 25 Oct 2018 13:33:06 +0000 (13:33 +0000)] 
Update netdb when tunneling requests (#314)

Updating netdb on tunneled transactions (e.g., CONNECT requests) is
especially important for origin servers that are only reached via
tunnels. Without updates, requests for such sites may always through a
cache_peer, even if a direct connection to them is much faster.

5 years agoFix client_connection_mark handling of clientless transactions (#312)
Alexander Gozman [Wed, 24 Oct 2018 15:28:13 +0000 (15:28 +0000)] 
Fix client_connection_mark handling of clientless transactions (#312)

Also affects the deprecated clientside_mark ACL.

Broken since CONNMARK matching was added in commit 653d992.

5 years agonetdb not saving to disk (#311)
chi-mf [Wed, 24 Oct 2018 12:12:09 +0000 (12:12 +0000)] 
netdb not saving to disk (#311)

5 years agoFix memory leak when parsing SNMP packet (#313)
flozilla [Wed, 24 Oct 2018 12:12:01 +0000 (14:12 +0200)] 
Fix memory leak when parsing SNMP packet (#313)

SNMP queries denied by snmp_access rules and queries with certain
unsupported SNMPv2 commands were leaking a few hundred bytes each. Such
queries trigger "SNMP agent query DENIED from..." WARNINGs in cache.log.

5 years agoFix several windows build issues (#309)
Francesco Chemolli [Tue, 23 Oct 2018 19:16:37 +0000 (19:16 +0000)] 
Fix several windows build issues (#309)

The mingw build has rotten somewhat, there are some type errors
and data access errors.
The fix is not yet complete, but it's a step forward

5 years agoCertificate fields injection via %D in ERR_SECURE_CONNECT_FAIL (#306) M-staged-PR306
Christos Tsantilas [Wed, 17 Oct 2018 15:14:07 +0000 (15:14 +0000)] 
Certificate fields injection via %D in ERR_SECURE_CONNECT_FAIL (#306)

%ssl_subject, %ssl_ca_name, and %ssl_cn values were not properly escaped
when %D code was expanded in HTML context of the ERR_SECURE_CONNECT_FAIL
template. This bug affects all ERR_SECURE_CONNECT_FAIL page templates
containing %D, including the default template.

Other error pages are not vulnerable because Squid does not populate %D
with certificate details in other contexts (yet).

Thanks to Nikolas Lohmann [eBlocker] for identifying the problem.

TODO: If those certificate details become needed for ACL checks or other
non-HTML purposes, make their HTML-escaping conditional.

This is a Measurement Factory project.

5 years agoDocs: Update stale version number in release notes (#303)
Amos Jeffries [Wed, 10 Oct 2018 18:49:10 +0000 (18:49 +0000)] 
Docs: Update stale version number in release notes (#303)

5 years agoAllow compilation with minimal OpenSSL (#281)
Eneas Queiroz [Wed, 10 Oct 2018 16:45:29 +0000 (16:45 +0000)] 
Allow compilation with minimal OpenSSL (#281)

Updated use of OpenSSL deprecated API, so that Squid can be compiled
with OpenSSL built with the OPENSSL_NO_DEPRECATED option. Such OpenSSL
builds are useful for saving storage space on embedded systems.

Also added compat/openssl.h -- a centralized OpenSSL portability shim.
Including it is now required before #including openssl/*.h headers.

5 years agoFixed %USER_CA_CERT_xx and %USER_CERT_xx crashes (#301)
chi-mf [Wed, 10 Oct 2018 07:50:52 +0000 (07:50 +0000)] 
Fixed %USER_CA_CERT_xx and %USER_CERT_xx crashes (#301)

The bug was introduced in 4e56d7f6 when the formatting code was moved
into Format::Format::assemble() where the old "format" loop variable is
a Format data member with the right type but (usually) the wrong value.

5 years agoImprove const correctness for hash_link (#300)
Amos Jeffries [Tue, 9 Oct 2018 11:36:14 +0000 (11:36 +0000)] 
Improve const correctness for hash_link (#300)

hash_link does not need to be modified to fetch its key
value. This allows display and fetch of hash keys for
objects which are const.

5 years agontlm_fake_auth: add ability to test delayed responses (#294) M-staged-PR294
Amos Jeffries [Mon, 8 Oct 2018 00:11:14 +0000 (00:11 +0000)] 
ntlm_fake_auth: add ability to test delayed responses (#294)

Add a -t parameter which sets a timeout to artificially delay
authentication responses by a fixed amount longer than their
normal delay.

This enables the fake authenticator to be used to test NTLM
client and Squid behaviour under various network latency and
stress conditions which delay ActiveDirectory responses.

5 years agoFix %>ru for CONNECT requests (#299) M-staged-PR299
Christos Tsantilas [Thu, 4 Oct 2018 10:15:15 +0000 (10:15 +0000)] 
Fix %>ru for CONNECT requests (#299)

Commit bec110e (a.k.a. v4 commit fbbd5cd5) broke CONNECT URI logging
because it incorrectly assumed that URI::absolute() supports all URIs.
As the result, Squid logged CONNECT URLs as "://host:port".

Also fixed a similar wrong assumption in ACLFilledChecklist::verifyAle()
which may affect URL-related ACL checks for CONNECT requests, albeit
only in already buggy cases where Squid warns about "ALE missing URL".

This is a Measurement Factory project

5 years agoSource Format Enforcement (#295) M-staged-PR295
squidadm [Sun, 30 Sep 2018 20:14:00 +0000 (20:14 +0000)] 
Source Format Enforcement (#295)

5 years agoFixed negotiate_kerberos_auth memory leaks (#285)
huaraz [Sun, 30 Sep 2018 09:51:55 +0000 (09:51 +0000)] 
Fixed negotiate_kerberos_auth memory leaks (#285)

The fixed leaks do not affect runtime (i.e. request processing) code.
The helper was not deallocating some memory when exiting.

5 years agoPrep for 4.3
Amos Jeffries [Sat, 29 Sep 2018 14:34:00 +0000 (03:34 +1300)] 
Prep for 4.3

5 years agoDocs: make doxygen happier and fix some comments (#293) M-staged-PR293
Amos Jeffries [Fri, 28 Sep 2018 15:33:12 +0000 (15:33 +0000)] 
Docs: make doxygen happier and fix some comments (#293)

* Update some code syntax for doxygen's naive parser.

* Fix duplicate section IDs in doxygen comments.

* Fix some doxygen markup typos.

* Remove an unnecessary todo.

No logical changes.

5 years agoBug 4885: Excessive memory usage when running out of descriptors (#291)
Craig Gowing [Thu, 27 Sep 2018 08:21:27 +0000 (08:21 +0000)] 
Bug 4885: Excessive memory usage when running out of descriptors (#291)

TcpAcceptor now stops listening when it cannot accept due to FD limits.
We also no longer defer/queue the same limited TcpAcceptor multiple
times. These changes prevent unbounded memory growth and improve
performance of Squids running out of file descriptors. They should have
no impact on other Squids.

5 years agocloneReply() "reply == NULL" assertion when denying replies (#292)
Eduard Bagdasaryan [Tue, 25 Sep 2018 14:42:01 +0000 (14:42 +0000)] 
cloneReply() "reply == NULL" assertion when denying replies (#292)

Commit e2cc8c0 lost argument nullification when converting old
HTTPMSGUNLOCK() macro into a function. This change restores that
important part of the HTTPMSGUNLOCK() API without sacrificing argument
type checks added during that conversion.

5 years agoBug 4875 pt1: GCC-8 compile errors with -O3 optimization (#287)
Amos Jeffries [Tue, 18 Sep 2018 17:43:59 +0000 (17:43 +0000)] 
Bug 4875 pt1: GCC-8 compile errors with -O3 optimization (#287)

 Use xstrncpy instead of strncat for String appending

Our xstrncpy() is safer, not assuming the existing char*
is nul-terminated and accounting explicitly for the
nul-terminator byte.

GCC-8 -O3 optimizations were exposing a strncat() output
truncation of the terminator when insufficient space was
available in the String buffer.

We suspect the GCC error to be a false-positive for -O3
builds and, even it it is accurate, these changes should
not affect builds with lower optimization levels.

5 years agolangpack: Add missing dialect aliases (#286)
Amos Jeffries [Mon, 17 Sep 2018 07:00:42 +0000 (07:00 +0000)] 
langpack: Add missing dialect aliases (#286)

ca-es - Spanish in Catalan
en-cn - English in mainland China
pt-xl - Portuguese in wider South America
en-xl - Spanish in wider South America

5 years agoFix range_offset_limit debugging (#164) M-staged-PR164
sujiacong [Mon, 17 Sep 2018 02:41:19 +0000 (02:41 +0000)] 
Fix range_offset_limit debugging (#164)

5 years agoFix basic_pop3_auth startup errors (#284)
Andreas Hasenack [Mon, 10 Sep 2018 19:40:55 +0000 (19:40 +0000)] 
Fix basic_pop3_auth startup errors (#284)

90cf12e added "use strict" which requires declaring all variables.

Originally reported (against Squid v3) at
https://bugs.launchpad.net/ubuntu/+source/squid3/+bug/1755189

5 years agoBug 4691: balance_on_multiple_ip config option docs (#273) 280/head
Amos Jeffries [Fri, 7 Sep 2018 16:11:33 +0000 (16:11 +0000)] 
Bug 4691: balance_on_multiple_ip config option docs (#273)

Add missing balance_on_multiple_ip removal documentation
after the active code was removed by 3.2 TCP connection
server selection changes.

5 years agoRemove non-standard, redundant new/delete operator replacements (#283)
Francesco Chemolli [Thu, 6 Sep 2018 15:24:37 +0000 (15:24 +0000)] 
Remove non-standard, redundant new/delete operator replacements (#283)

This change also fixes icc builds: Commit 39cca4e missed noexcept
specification for nothrow variants of new and delete operators,
and the icc compiler did not like that.

Furthermore, we can simplify the replacements because, according
to cppreference, with C++11, "replacing the throwing single object
allocation functions is sufficient to handle all [allocations and
deallocations]".

5 years agoBug 4877: Add missing text about external_acl_type %DATA changes (#276) M-staged-PR276
Amos Jeffries [Wed, 5 Sep 2018 18:17:48 +0000 (18:17 +0000)] 
Bug 4877: Add missing text about external_acl_type %DATA changes (#276)

Conversion of external_acl_type to using logformat macros was
not quite seamless. The %DATA macro now expands to a dash '-' to
fix helpers using it explicitly from receiving incorrect number
of fields (and misaligned input) on their input lines.

Unfortunately that also results in the implicit use of that
macro expanding to non-whitespace ('-'). That small fact was not
documented in the initial v4 release notes and config texts.

5 years agoBug 4716: Blank lines in cachemgr.conf are not skipped (#274) M-staged-PR274
Amos Jeffries [Wed, 5 Sep 2018 15:23:45 +0000 (15:23 +0000)] 
Bug 4716: Blank lines in cachemgr.conf are not skipped (#274)

The default cachemgr.conf contains three lines other than
comments. Two of them are blank, the third is "localhost".
These blank lines show up in the "Cache Server" list in the
CGI output.

5 years agoRemove reference on bzr from test-suite (#282)
Francesco Chemolli [Tue, 4 Sep 2018 21:44:44 +0000 (22:44 +0100)] 
Remove reference on bzr from test-suite (#282)

5 years agoUpdate systemd dependencies in squid.service (#264) M-staged-PR264 SQUID_3_5_27
Amos Jeffries [Tue, 7 Aug 2018 13:00:02 +0000 (13:00 +0000)] 
Update systemd dependencies in squid.service (#264)

The network.target is not sufficient to guarantee network
interfaces and IPs are assigned and available. Particularly when
systemd is not in charge of the IP assignment itself.

Use network-online.target as well, which should ensure network
is properly configured and online before starting Squid.

5 years agoPrep for 4.2 (#268) M-staged-PR268
Amos Jeffries [Sat, 4 Aug 2018 19:40:10 +0000 (19:40 +0000)] 
Prep for 4.2 (#268)

Assuming that PR 247 is merged within the next day
and backported with this.

5 years agoDo not update stored headers on HTTP 304 responses (#267) M-staged-PR267
Alex Rousskov [Thu, 2 Aug 2018 17:23:15 +0000 (17:23 +0000)] 
Do not update stored headers on HTTP 304 responses (#267)

... until we learn how to synchronize stored and in-transit metadata.

This temporary disables a feature first introduced in commit abf396e.

5 years agoFixed build on FreeBSD v11.2 (#266) M-staged-PR266
Ture Pålsson [Wed, 1 Aug 2018 15:34:09 +0000 (15:34 +0000)] 
Fixed build on FreeBSD v11.2 (#266)

... and other platforms where htonl() is a macro that uses its argument
multiple times (GCC -Werror=sequence-point).

5 years agoDo not send Content-Length in 1xx or 204 responses (#249)
Eduard Bagdasaryan [Tue, 31 Jul 2018 22:08:31 +0000 (22:08 +0000)] 
Do not send Content-Length in 1xx or 204 responses (#249)

This is RFC 7230 section 3.3.2 requirement.

5 years agoUse AnyP::Uri to generate ASN request URI (#258) M-staged-PR258
Amos Jeffries [Fri, 27 Jul 2018 00:12:11 +0000 (00:12 +0000)] 
Use AnyP::Uri to generate ASN request URI (#258)

Removes the fixed size asres c-string buffer the URL was
using by replacing with an SBuf and dynamic xstrdup().

Also, make AS_REQBUF_SZ configurable at build time with
-DAS_REQBUF_SZ=nn.

TODO: convert the store API to accept AnyP::Uri instead of
c-string will remove 1-2 memory reallocations.

5 years agoOptimization: Faster response headers packing (#230) M-staged-PR230
Eduard Bagdasaryan [Thu, 26 Jul 2018 17:44:14 +0000 (17:44 +0000)] 
Optimization: Faster response headers packing (#230)

Packing reply headers into StoreEntry/ShmWriter directly means numerous
tiny append() calls which involve expensive mem_node/slice searches. For
example, every two-byte ": " and CRLF delimiter is packed separately.

5 years agoBug 4870: milliseconds logformats prepend 0s instead of spaces (#255) M-staged-PR255
Amos Jeffries [Wed, 25 Jul 2018 13:47:20 +0000 (13:47 +0000)] 
Bug 4870: milliseconds logformats prepend 0s instead of spaces (#255)

5 years agoRestored support for the https_port clientca option (#252) M-staged-PR252
Alex Rousskov [Wed, 18 Jul 2018 04:10:00 +0000 (04:10 +0000)] 
Restored support for the https_port clientca option (#252)

Probably missing since commit 621f429.

5 years agoTrivialDB support (#223)
Amos Jeffries [Tue, 17 Jul 2018 23:36:31 +0000 (23:36 +0000)] 
TrivialDB support (#223)

Allow use of Samba TrivialDB instead of outdated BerkleyDB in
the session helper.

Require TrivialDB support for use of the time_quota helper.
libdb v1.85 is no longer supported by distributors and
upgrading to v5 only to deprecate use does not seem to be
worthwhile.

5 years agoFix %>ru logging of huge URLs (#229) M-staged-PR229
Eduard Bagdasaryan [Tue, 17 Jul 2018 15:31:23 +0000 (15:31 +0000)] 
Fix %>ru logging of huge URLs (#229)

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.

5 years agoRemove NullStoreEntry (#241) M-staged-PR241
Eduard Bagdasaryan [Mon, 16 Jul 2018 12:47:52 +0000 (12:47 +0000)] 
Remove NullStoreEntry (#241)

A nil pointer is the proper way to indicate a missing heap-allocated
object in C++. Removing NullStoreEntry simplifies and optimizes code.
This removal also brings us one step closer to removing all virtual
methods from StoreEntry, further optimizing code and even saving 8 bytes
per non-shared memory cache entry on most platforms.

Also un-virtualized a few StoreEntry-only methods to optimize their
callers.

5 years agoOptimization: Fewer memory (re)allocations for HTTP headers (#239) M-staged-PR239
Eduard Bagdasaryan [Fri, 13 Jul 2018 21:27:19 +0000 (21:27 +0000)] 
Optimization: Fewer memory (re)allocations for HTTP headers (#239)

Tests revealed multiple fresh memory allocations/deallocations while
storing small (few fields) HTTP headers. Many popular sites use larger
headers (15-30 fields). To avoid expensive memory operations:

1. Pool all std::vector<HttpHeaderEntries*> memory allocations.
2. Prevent reallocations (for HTTP headers with fewer than 32 fields).

This optimization deals with storing the header index. It does not
affect how individual header fields are stored.

5 years agoPrep for 3.5.28 (#251)
Amos Jeffries [Tue, 10 Jul 2018 20:20:48 +0000 (20:20 +0000)] 
Prep for 3.5.28  (#251)

Documentation updates for next 3.5 release.

5 years agoThe %>handshake logformat code (#243)
Christos Tsantilas [Tue, 10 Jul 2018 09:07:16 +0000 (09:07 +0000)] 
The %>handshake logformat code (#243)

Logging client "handshake" bytes is useful in at least two contexts:

* Runtime traffic bypass and bumping/splicing decisions. Identifying
  popular clients like Skype for Business (that uses a TLS handshake but
  then may not speak TLS) is critical for handling their traffic
  correctly. Squid does not have enough ACLs to interrogate most TLS
  handshake aspects. Adding more ACLs may still be a good idea, but
  initial sketches for SfB handshakes showed rather complex
  ACLs/configurations, _and_ no reasonable ACLs would be able to handle
  non-TLS handshakes. An external ACL receiving the handshake is in a
  much better position to analyze/fingerprint it according to custom
  admin needs.

* A logged handshake can be used to analyze new/unusual traffic or even
  trigger security-related alarms.

The current support is limited to cases where Squid was saving handshake
for other reasons. With enough demand, this initial support can be
extended to all protocols and port configurations.

This is a Measurement Factory project.

5 years agoSource Format Enforcement (#244)
squidadm [Mon, 9 Jul 2018 09:15:57 +0000 (09:15 +0000)] 
Source Format Enforcement (#244)

5 years agoBug 4865: Unexpected exception on startup in TypedMsgHdr::sync() (#242) M-staged-PR242
Alex Rousskov [Fri, 6 Jul 2018 23:58:22 +0000 (23:58 +0000)] 
Bug 4865: Unexpected exception on startup in TypedMsgHdr::sync() (#242)

Commit b56b37c broke Ipc::TypedMsgHdr copying by incorrectly assuming
that sync() sets name and ios members. The sync() method sets _other_
(low level) members based on name and ios.

5 years agoDo not assign nil values in ACLFilledChecklist::syncAle() (#240)
Eduard Bagdasaryan [Fri, 6 Jul 2018 12:34:30 +0000 (12:34 +0000)] 
Do not assign nil values in ACLFilledChecklist::syncAle() (#240)

Being explicit about nil parameters protects (future) code from
dereferencing them.

5 years agoOptimization: Fewer epoll(2) system calls when closing a socket (#235) M-staged-PR235
Eduard Bagdasaryan [Fri, 6 Jul 2018 04:08:37 +0000 (04:08 +0000)] 
Optimization: Fewer epoll(2) system calls when closing a socket (#235)

Squid was calling epoll(2) twice to clear a socket interest. One call is
more than enough: Technically, close(2) is supposed to clear epoll(2)
registration for us, but I did not risk relying on that.

In other environments, socket interest changes are pooled together
before being submitted to the OS, so Squid was doing a bit of extra
work, but not making (many) extra system calls AFAICT.

Also fixed (previously unused) Comm::ResetSelect() on these platforms:
* epoll(2): The old resetting code did not clear our interest AFAICT.
* kqueue(2): The old resetting code made no sense to me at all.
* poll(2): There was no code at all.
* select(Win32): There was no code at all.

Even though Comm::ResetSelect() implementation is now the same for all
platforms, I did not make that code platform-agnostic because it is
possible to optimize it further in platform-specific ways.

5 years agoDocumented when helper requests get queued (#238) M-staged-PR238
Alex Rousskov [Wed, 4 Jul 2018 15:59:26 +0000 (15:59 +0000)] 
Documented when helper requests get queued (#238)

I had to change introductory paragraphs in several directives so that
the new documentation can refer to "numberofchildren". I fixed a few
spelling/grammar problems in changed paragraphs and edited them a bit
for consistency, but they need more work.

Motivation:
http://lists.squid-cache.org/pipermail/squid-users/2018-July/018577.html

5 years agoFix segmentation fault on -k parse (#218) M-staged-PR218
Amos Jeffries [Wed, 4 Jul 2018 10:30:12 +0000 (10:30 +0000)] 
Fix segmentation fault on -k parse (#218)

When an HTTPS or SSL-Bump port is configured without a cert=
parameter it results in a segmentation fault. Detect that
occurance and add the required FATAL error message instead for
these configurations where cert= is a parameter rather than an
option.

Our project terminology for config settings is;

 "parameter"
 -  a required setting. Print a FATAL error message if missing.

 "option"
 -  an optional setting. Ignored or default value if missing.

5 years agoBug 4843 pt3: GCC-8 fixes and refactoring (#172)
Amos Jeffries [Wed, 4 Jul 2018 06:54:17 +0000 (06:54 +0000)] 
Bug 4843 pt3: GCC-8 fixes and refactoring (#172)

GCC-8 enables a lot more warnings related to unsafe coding
practices. The old Squid code contains a lot of risky buffer
size assumptions and implicit assumptions about C-string strcat,
strncat and snprintf  changes when operating on those buffers -
many can result in output truncation. Squid's use of -Werror
makes these many issues all go from warnings to outright
compile failures.

Rather than just extending the char* buffer sizes not to
truncate this work seeks to actually remove the issues
permanently by converting to SBuf and updated Squid coding
styles.

The C++1z compilers (GCC-8 and Clang 4.0) are beginning to warn
about C functions memset/memcpy/memmove being used on class
objects which lack "trivial copy" constructor or assignment
operator - their use is potentially unsafe where anything more
complex than trivial copy/blit is required. A number of classes
in Squid are safely copied or initialized with those functions
for now but again the -Werror makes these hard errors.
Completing affected objects conversion from C to C++ code avoids
any deeply hidden issues or adding compiler exceptions to
silence the warnings.

see individual commit messages for details on the particular
changes each does.

5 years agoMaintenance: Fix mkrelease.sh script (#237) M-staged-PR237
Amos Jeffries [Tue, 3 Jul 2018 03:28:52 +0000 (03:28 +0000)] 
Maintenance: Fix mkrelease.sh script (#237)

Release of 4.1 revealed that this regex is not fully working.
The final .NN version field is now optional.

5 years agoOptimization: Do not create/configure ACLFilledChecklist in vain (#232)
Eduard Bagdasaryan [Mon, 2 Jul 2018 12:41:26 +0000 (12:41 +0000)] 
Optimization: Do not create/configure ACLFilledChecklist in vain (#232)

While client_db is required for client-side pools to work, it may be
enabled for other reasons, without any client-side pools configured. We
should not create and configure useless ACLFilledChecklist objects
because those operations are already not trivial today and have a
a tendency of becoming more expensive with time.

5 years agoOptimization: Reuse CharacterSets when parsing HTTP responses (#231)
Eduard Bagdasaryan [Mon, 2 Jul 2018 03:14:14 +0000 (03:14 +0000)] 
Optimization: Reuse CharacterSets when parsing HTTP responses (#231)

Expensive CharacterSet objects creation and manipulation was happening
for virtually every HTTP miss since 6fe0370.

Also removed code duplication.

5 years agov4.1 release notes (#234)
Amos Jeffries [Mon, 2 Jul 2018 03:14:06 +0000 (15:14 +1200)] 
v4.1 release notes (#234)

* Release Notes update for 4.1

* Update CONTRIBUTORS from changeset records

* Add ChangeLog entries for scheduled backports

5 years agoResume using "Short Strings" memory pool ignored since 91bb468 (#227) M-staged-PR227
Eduard Bagdasaryan [Thu, 28 Jun 2018 17:14:32 +0000 (17:14 +0000)] 
Resume using "Short Strings" memory pool ignored since 91bb468 (#227)

memFindStringSizeType() misused mem_type as a string pool index,
resulting in index 0 (of the first pool) mapped to MEM_NONE and ignored.