]> git.ipfire.org Git - thirdparty/squid.git/log
thirdparty/squid.git
7 years ago4.0.18 SQUID_4_0_18
Amos Jeffries [Sun, 5 Feb 2017 21:14:37 +0000 (10:14 +1300)] 
4.0.18

7 years agoFix crash when configuring with invalid delay_parameters restore value.
Alex Rousskov [Sun, 5 Feb 2017 20:56:55 +0000 (09:56 +1300)] 
Fix crash when configuring with invalid delay_parameters restore value.

... like none/none. Introduced in r13701 which fixed another, much
bigger delay_parameters parsing bug.

TODO: Reject all invalid input, including restore/max of "-/100".

TODO: Fix misleading/wrong associated error messages. For example:
  ERROR: invalid delay rate 'none/none'. Expecting restore/max or 'none'
  ERROR: restore rate in '1/none' is not a number.

7 years agoFix Auth::UserRequest::denyMessage() misuse.
Eduard Bagdasaryan [Sun, 5 Feb 2017 20:52:41 +0000 (09:52 +1300)] 
Fix Auth::UserRequest::denyMessage() misuse.

This method was improperly used in contexts where actually
Auth::UserRequest::setDenyMessage() expected. Probably the reason was
that both denyMessage() and getDenyMessage() were not constant,
provoking such 'misuse'.

Also placed some common code into UserRequest::denyMessageFromHelper(),
eliminating code duplication. Though there are still many places
where code is duplicated inside auth/ntlm/UserRequest.cc and
auth/negotiate/UserRequest.cc.

7 years agoBug 4661: compile error 'warning: _XPG4_2 redefined' with GCC on Solaris 10
Amos Jeffries [Sun, 5 Feb 2017 06:15:44 +0000 (19:15 +1300)] 
Bug 4661: compile error 'warning: _XPG4_2 redefined' with GCC on Solaris 10

7 years agoPrep for 3.5.24
Amos Jeffries [Sat, 28 Jan 2017 03:36:52 +0000 (16:36 +1300)] 
Prep for 3.5.24

7 years agoSSLv2 records force SslBump bumping despite a matching step2 peek rule.
Christos Tsantilas [Fri, 27 Jan 2017 14:50:22 +0000 (03:50 +1300)] 
SSLv2 records force SslBump bumping despite a matching step2 peek rule.

If Squid receives a valid TLS Hello encapsulated into ancient SSLv2
records (observed on Solaris 10), the old code ignored the step2 peek
decision and bumped the transaction instead.
Now Squid peeks (or stares) at the origin server as configured, even
after detecting (and parsing) SSLv2 records.

This is a Measurement Factory project.

7 years agoComplain about malformed 64bit header values, not the valid ones.
Alex Rousskov [Fri, 27 Jan 2017 13:28:31 +0000 (02:28 +1300)] 
Complain about malformed 64bit header values, not the valid ones.

Added this regression in r14819, apparently confused by my own
unfortunate "bad is true" httpHeaderNoteParsedEntry(error) API.

7 years agoBug 4636: assertion failed: client_side.cc:1448: 'byteCount > 0 && byteCount <= inBuf...
Amos Jeffries [Fri, 27 Jan 2017 13:24:30 +0000 (02:24 +1300)] 
Bug 4636: assertion failed: client_side.cc:1448: 'byteCount > 0 && byteCount <= inBuf.length()'

7 years agoMitigate DoS attacks that use client-initiated SSL/TLS renegotiation.
Christos Tsantilas [Fri, 27 Jan 2017 13:18:42 +0000 (02:18 +1300)] 
Mitigate DoS attacks that use client-initiated SSL/TLS renegotiation.

There is a well-known DoS attack using client-initiated SSL/TLS
renegotiation. The severety or uniqueness of this attack method
is disputed, but many believe it is serious/real.
There is even a (disputed) CVE 2011-1473:
    https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2011-1473

The old Squid code tried to disable client-initiated renegotiation, but
it did not work reliably (or at all), depending on Squid version, due
to OpenSSL API changes and conflicting SslBump callbacks. That
code is now removed and client-initiated renegotiations are allowed.

With this change, Squid aborts the TLS connection, with a level-1 ERROR
message if the rate of client-initiated renegotiate requests exceeds
5 requests in 10 seconds (approximately). This protection and the rate
limit are currently hard-coded but the rate is not expected to be
exceeded under normal circumstances.

This is a Measurement Factory project.

7 years agoFix some spelling mistakes
Frederic Bourgeois [Fri, 27 Jan 2017 11:23:08 +0000 (00:23 +1300)] 
Fix some spelling mistakes

7 years agoCleanup: convert Delay Pool classes to MEMPROXY
Amos Jeffries [Fri, 27 Jan 2017 11:04:30 +0000 (00:04 +1300)] 
Cleanup: convert Delay Pool classes to MEMPROXY

7 years agoBug 4610: fix 'Assigning a negative value to an implicit unsigned bitfield' on Solaris 11
Stefan Kruger [Fri, 27 Jan 2017 08:38:51 +0000 (21:38 +1300)] 
Bug 4610: fix 'Assigning a negative value to an implicit unsigned bitfield' on Solaris 11

7 years agosquidclient: link GnuTLS library debug to -v level display
Amos Jeffries [Fri, 27 Jan 2017 00:37:07 +0000 (13:37 +1300)] 
squidclient: link GnuTLS library debug to -v level display

7 years agoUpdate External ACL helpers error handling and caching
Christos Tsantilas [Thu, 26 Jan 2017 17:46:17 +0000 (06:46 +1300)] 
Update External ACL helpers error handling and caching

The helper protocol for external ACLs [1] defines three possible return values:
   OK - Success. ACL test matches.
   ERR - Success. ACL test fails to match.
   BH - Failure. The helper encountered a problem.

The external acl helpers distributed with squid currently do not follow this
definition. For example, upon connection error, ERR is returned:

   $ ext_ldap_group_acl ... -d
   ext_ldap_group_acl: WARNING: could not bind to binddn 'Can't contact LDAP server'
   ERR

This does not allow to distinguish "no match" and "error" either and
therefore negative caches "ERR", also in the case of an error.

Moreover there are multiple problems inside squid when trying to handle BH
responses:
  - Squid-5 and Squid-4 retry requests for BH responses but crashes after the
    maximum retry number (currently 2) is reached.
  - If an external acl helper return always BH (eg because the LDAP server is
    down) squid sends infinitely new request to the helper.

This is a Measurement Factory project

7 years agoFix "Source and destination overlap in memcpy" Valgrind errors
Eduard Bagdasaryan [Tue, 24 Jan 2017 11:02:51 +0000 (00:02 +1300)] 
Fix "Source and destination overlap in memcpy" Valgrind errors

Before this patch, source and destination arguments in
log_quoted_string() could point to the same static memory area, causing
multiple Valgrind-reported errors. Fixed by creating another buffer to
store quoted-processed output string.

7 years agoReduce crashes due to unexpected ClientHttpRequest termination.
Christos Tsantilas [Sun, 22 Jan 2017 11:43:44 +0000 (00:43 +1300)] 
Reduce crashes due to unexpected ClientHttpRequest termination.

The underlying problem has been known since r13480: If a
ClientHttpRequest job ends without Http::Stream (and ConnStateData)
knowledge, then Squid is likely to segfault or assert. This patch does
not resolve the underlying issue (a proper fix would require
architectural changes in a consensus-lacking area) but makes an
unexpected ClientHttpRequest job destruction less likely.

BodyPipe and Adaptation-related exceptions are the major causes of
unexpected ClientHttpRequest job destruction. This patch handles them by
closing the client connection. Connection closure should trigger an
orderly top-down cleanup, including Http::Stream, ConnStateData, and
ClientHttpRequest destruction.

If there is no connection to close, then the exception is essentially
ignored with a level-1 error message disclosing the problem. The side
effects of ignoring such exceptions are unknown, but without a client
connection, it is our hope that they would be relatively benign.

This is a Measurement Factory project.

7 years agoAdd several missing copyright blurbs
Amos Jeffries [Sat, 7 Jan 2017 11:02:40 +0000 (00:02 +1300)] 
Add several missing copyright blurbs

7 years agoDetect HTTP header ACL issues
Amos Jeffries [Sat, 7 Jan 2017 11:01:20 +0000 (00:01 +1300)] 
Detect HTTP header ACL issues

rep_header and req_header ACL types cannot match multiple different
headers in one test (unlike Squid-2 appears to have done). Produce
an ERROR and ignore the extra line(s) instead of silently changing
all the previous regex to match the second header name.

Also detect and ERROR when header name is missing entirely. Ignore
these lines instead of asserting.

7 years agoSourceFormat Enforcement
Source Maintenance [Sun, 1 Jan 2017 06:14:00 +0000 (06:14 +0000)] 
SourceFormat Enforcement

7 years agoSourceFormat Enforcement
Source Maintenance [Sun, 1 Jan 2017 00:14:42 +0000 (00:14 +0000)] 
SourceFormat Enforcement

7 years agoBug 4599 pt6: Restrict safe renegotiation disable to OpenSSL 1.0 and older
Christos Tsantilas [Sat, 31 Dec 2016 02:46:50 +0000 (15:46 +1300)] 
Bug 4599 pt6: Restrict safe renegotiation disable to OpenSSL 1.0 and older

From OpenSSL 1.1.0 documentation:
 "OpenSSL always attempts to use secure renegotiation as described in RFC5746.
  This counters the prefix attack described in CVE-2009-3555 and elsewhere."

7 years agoBug 4599 pt5: various OpenSSL-1.x API compatibility fixes
Christos Tsantilas [Sat, 31 Dec 2016 02:45:59 +0000 (15:45 +1300)] 
Bug 4599 pt5: various OpenSSL-1.x API compatibility fixes

7 years agoBug 4599 pt4: Disable RSA weak ephemeral key exchange for OpenSSL-1.1
Christos Tsantilas [Sat, 31 Dec 2016 02:44:41 +0000 (15:44 +1300)] 
Bug 4599 pt4: Disable RSA weak ephemeral key exchange for OpenSSL-1.1

From OpenSSL  changeLog:
     Remove support for all 40 and 56 bit ciphers.  This includes all the export
     ciphers who are no longer supported and drops support the ephemeral RSA key
     exchange. The LOW ciphers currently doesn't have any ciphers in it.
     [Kurt Roeckx]

OpenSSL 1.1.0  drops EXPORT ciphers and ephemeral RSA. The ssl_temp_rsa_cb used
here. The OpenSSL manual for this function is:
  https://wiki.openssl.org/index.php/Manual:SSL_CTX_set_tmp_rsa_callback(3)

7 years agobasic_sasl_auth: Add copyright blurb to SASL config file
Amos Jeffries [Mon, 26 Dec 2016 02:29:24 +0000 (15:29 +1300)] 
basic_sasl_auth: Add copyright blurb to SASL config file

7 years agoFix GCC6: unused local variable 'weInitiatedThisClosure'
Amos Jeffries [Mon, 26 Dec 2016 02:28:24 +0000 (15:28 +1300)] 
Fix GCC6: unused local variable 'weInitiatedThisClosure'

7 years agoBug 3940 pt2: Make 'cache deny' do what is documented
Amos Jeffries [Mon, 26 Dec 2016 02:15:22 +0000 (15:15 +1300)] 
Bug 3940 pt2: Make 'cache deny' do what is documented

Instead of overriding whatever cacheability was previously set to
(including changing non-cacheables to be cacheable) actually
prevent both cache read and write.

This 'regression' appears after initial bug 3940 fix.

7 years ago4.0.17 SQUID_4_0_17
Amos Jeffries [Fri, 16 Dec 2016 04:14:12 +0000 (17:14 +1300)] 
4.0.17

7 years agoDo not share private responses with collapsed client(s).
Eduard Bagdasaryan [Fri, 16 Dec 2016 02:43:39 +0000 (15:43 +1300)] 
Do not share private responses with collapsed client(s).

This excessive sharing problem with collapsed forwarding code has
several layers. In most cases, the core CF code does not share
uncachable or private response with collapsed clients because of the
refreshCheckHTTP() check. However, some responses might not be subject
to that (or equivalent) check. More importantly, collapsed revalidation
code does not check its responses at all and, hence, easily shares
private responses.

This short-term fix incorrectly assumes that an entry may become private
(KEY_PRIVATE) only when it cannot be shared among multiple clients
(e.g., because of a Cache-Control:private response header). However,
there are a few other cases when an entry becomes private. One of them
is a DISK_NO_SPACE_LEFT error inside storeSwapOutFileClosed() where
StoreEntry::releaseRequest() sets KEY_PRIVATE for a sharable entry [that
may still be perfectly preserved in the memory cache]. Consequently, the
short-term fix reduces CF effectiveness. The extent of this reduction is
probably environment-dependent.

Also: do not re-use SET_COOKIE headers for collapsed revalidation slaves,
i.e., adhere to the same requirement as for regular response HITs.

7 years agoBug 2258 pt2: bypassing cache but not destroying cache entry
Garri Djavadyan [Thu, 15 Dec 2016 07:54:42 +0000 (20:54 +1300)] 
Bug 2258 pt2: bypassing cache but not destroying cache entry

7 years agoCleanup: Refactor custom ACL-controlled actions configuration code.
Eduard Bagdasaryan [Sun, 11 Dec 2016 18:23:23 +0000 (07:23 +1300)] 
Cleanup: Refactor custom ACL-controlled actions configuration code.

* Reduced parsing code duplication by adding ParseAclWithAction().

* Used functors for generic action-to-string conversions. It is possible
  now to perform such conversions providing lambda expressions.

* Used vectors of strings instead of C-style arrays for storing
  conversion tables and check against bounds with vector::at().

7 years agoBug 4169: HIT marked as MISS when If-None-Match does not match
Garri Djavadyan [Sun, 11 Dec 2016 09:46:22 +0000 (22:46 +1300)] 
Bug 4169: HIT marked as MISS when If-None-Match does not match

7 years agoHTTP/1.1: Add registered codes entry for new 103 (Early Hints) status code
Amos Jeffries [Sat, 10 Dec 2016 22:36:57 +0000 (11:36 +1300)] 
HTTP/1.1: Add registered codes entry for new 103 (Early Hints) status code

7 years agoBug 3940 (partial): hostHeaderVerify failures MISS when they should be HIT
Garri Djavadyan [Fri, 9 Dec 2016 04:42:34 +0000 (17:42 +1300)] 
Bug 3940 (partial): hostHeaderVerify failures MISS when they should be HIT

This fixes the critical condition leading to the HIT. However not all
code is correctly setting flags.noCache and flags.cacheable (see bugzilla).
So there may be other fixes needed after this.

7 years agoBug 2258: bypassing cache but not destroying cache entry
Garri Djavadyan [Fri, 9 Dec 2016 03:01:51 +0000 (16:01 +1300)] 
Bug 2258: bypassing cache but not destroying cache entry

7 years agoBug 4406: SIGSEV in TunnelStateData::handleConnectResponse() during reconfigure and...
Michael Buchau [Fri, 9 Dec 2016 01:44:19 +0000 (14:44 +1300)] 
Bug 4406: SIGSEV in TunnelStateData::handleConnectResponse() during reconfigure and restart

7 years agoSupport IPv6 NAT with PF for NetBSD and FreeBSD
Egervary Gergely [Fri, 9 Dec 2016 00:49:36 +0000 (13:49 +1300)] 
Support IPv6 NAT with PF for NetBSD and FreeBSD

7 years agoCleanup: remove raw-pointer SSL* from ServerBump class API
Amos Jeffries [Thu, 8 Dec 2016 14:36:30 +0000 (03:36 +1300)] 
Cleanup: remove raw-pointer SSL* from ServerBump class API

7 years agoBug 3290: authenticate_ttl not working for digest authentication
Garri Djavadyan [Tue, 29 Nov 2016 18:49:22 +0000 (07:49 +1300)] 
Bug 3290: authenticate_ttl not working for digest authentication

7 years agoBug 4007: Hang on DNS query with dead-end CNAME
Stephen Baynes [Tue, 29 Nov 2016 17:27:42 +0000 (06:27 +1300)] 
Bug 4007: Hang on DNS query with dead-end CNAME

DNS lookup recursion no longer occurs. ipcacheParse() return values are no
longer useful.

Also, cleanup the debugging output.

7 years agoCleanup: use return after self_destruct() to make Coverity happier
Amos Jeffries [Tue, 29 Nov 2016 16:38:45 +0000 (05:38 +1300)] 
Cleanup: use return after self_destruct() to make Coverity happier

 Detected by Coverity Scan. Issue 1154218.

7 years agoCleanup: replace HTTP Request bitmap flags with boolean
Amos Jeffries [Tue, 29 Nov 2016 04:50:02 +0000 (17:50 +1300)] 
Cleanup: replace HTTP Request bitmap flags with boolean

7 years agoBug 4174 partial: fix Write.cc:41 "!ccb->active()" assertion.
Christos Tsantilas [Mon, 28 Nov 2016 10:08:16 +0000 (23:08 +1300)] 
Bug 4174 partial: fix Write.cc:41 "!ccb->active()" assertion.

The following sequence of events triggers this assertion:
  - The server sends an 1xx control message.
  - http.cc schedules ConnStateData::sendControlMsg call.
  - Before sendControlMsg is fired, http.cc detects an error (e.g., I/O
    error or timeout) and starts writing the reply to the user.
  - The ConnStateData::sendControlMsg is fired, starts writing 1xx, and
    hits the "no concurrent writes" assertion.

We could only reproduce this sequence in the lab after changing Squid
code to trigger a timeout at the right moment, but the sequence looks
plausible. Other event sequences might result in the same outcome.

To avoid concurrent writes, Squid now drops the control message if
Http::One::Server detects that a reply is already being written. Also,
ConnStateData delays reply writing until a pending control message write
has been completed.

This is a Measurement Factory project.

7 years agoFix Null pointer dereferences after rev.14913
Amos Jeffries [Sat, 19 Nov 2016 16:06:10 +0000 (05:06 +1300)] 
Fix Null pointer dereferences after rev.14913

on_unsupported_protocol with non-HTTP requests occurs without
an HTTP request object. Some ACLs will not be possible to check
but that is not a reason to crash.

 Detected by Coverity Scan. Issue 1394291.

7 years agoBug 4599 pt3: use wrapper functions to access BIO object internals
Christos Tsantilas [Sat, 19 Nov 2016 15:53:46 +0000 (04:53 +1300)] 
Bug 4599 pt3: use wrapper functions to access BIO object internals

7 years agoTLS: Add ErrorString() function to libsecurity API
Amos Jeffries [Sat, 19 Nov 2016 15:46:24 +0000 (04:46 +1300)] 
TLS: Add ErrorString() function to libsecurity API

To convert library error codes to strings in a library agnostic way.

7 years agoBug 4630: user credentials cache cleanup not re-scheduled
Garri Djavadyan [Sat, 19 Nov 2016 06:52:34 +0000 (19:52 +1300)] 
Bug 4630: user credentials cache cleanup not re-scheduled

7 years agoBug 4599 pt2: use functor for locking in libsecurity Pointers
Amos Jeffries [Fri, 18 Nov 2016 20:21:39 +0000 (09:21 +1300)] 
Bug 4599 pt2: use functor for locking in libsecurity Pointers

7 years agoBug 3533: Cache still valid after HTTP/1.1 303 See Other
Garri Djavadyan [Fri, 18 Nov 2016 12:59:09 +0000 (01:59 +1300)] 
Bug 3533: Cache still valid after HTTP/1.1 303 See Other

RFC7231 does not mention 303 response as non-cacheable.
So, assuming that means it *is* cacheable.

7 years agoFix segfault via Ftp::Client::readControlReply
Christos Tsantilas [Fri, 18 Nov 2016 12:57:25 +0000 (01:57 +1300)] 
Fix segfault via Ftp::Client::readControlReply

Added nil dereference checks for Ftp::Client::ctrl.conn, including:
- Ftp::Client::handlePasvReply() and handleEpsvReply() that dereference
  ctrl.conn in DBG_IMPORTANT messages.
- Many functions inside FtpClient.cc and FtpGateway.cc files.

TODO: We need to find a better way to handle nil ctrl.conn. It is only
a matter of time when we forget to add another dereference check or
discover a place we missed during this change.

Also disabled forwarding of EPRT and PORT commands to origin servers.
Squid support for those commands is broken and their forwarding may
cause segfaults (bug #4004). Active FTP is still supported, of course.

This is a Measurement Factory project

7 years agoFix some missing returns after rev.14933
Amos Jeffries [Fri, 11 Nov 2016 04:29:21 +0000 (17:29 +1300)] 
Fix some missing returns after rev.14933

7 years agoBug 3379: Combination of If-Match and a Cache Hit result in TCP Connection Failure
Garri Djavadyan [Fri, 11 Nov 2016 02:08:24 +0000 (15:08 +1300)] 
Bug 3379: Combination of If-Match and a Cache Hit result in TCP Connection Failure

7 years agoBranch 5.0.0
Source Maintenance [Wed, 9 Nov 2016 13:33:41 +0000 (13:33 +0000)] 
Branch 5.0.0

7 years agoTLS: use Security::SessionPointer for helper state maintenance
Amos Jeffries [Tue, 8 Nov 2016 06:37:32 +0000 (19:37 +1300)] 
TLS: use Security::SessionPointer for helper state maintenance

7 years agoImprove debugs warnings when loading signing certs fails
Amos Jeffries [Tue, 8 Nov 2016 06:34:59 +0000 (19:34 +1300)] 
Improve debugs warnings when loading signing certs fails

7 years agoMake key= before cert= a fatal error instead of quietly hiding the issue
Amos Jeffries [Tue, 8 Nov 2016 06:33:38 +0000 (19:33 +1300)] 
Make key= before cert= a fatal error instead of quietly hiding the issue

7 years agoBug 4599 pt1: initial support for OpenSSL v1.1
Amos Jeffries [Mon, 7 Nov 2016 10:49:37 +0000 (23:49 +1300)] 
Bug 4599 pt1: initial support for OpenSSL v1.1

Converts some CRYPTO_add(..., CRYPTO_LOCK_X509) calls with portability
wrapper for X509_up_ref(). Just the calls which are in code not yet using
Security::CertPointer.

7 years agoBug 4610 pt2: compile errors on Solaris 11.3 with Oracle Studio 12.5
Amos Jeffries [Mon, 7 Nov 2016 07:37:33 +0000 (20:37 +1300)] 
Bug 4610 pt2: compile errors on Solaris 11.3 with Oracle Studio 12.5

7 years agoCleanup: remove needless get() in libsecurity
Amos Jeffries [Mon, 7 Nov 2016 06:15:04 +0000 (19:15 +1300)] 
Cleanup: remove needless get() in libsecurity

7 years agoCleanup: remove unused Config::ext_methods
Amos Jeffries [Mon, 7 Nov 2016 05:24:26 +0000 (18:24 +1300)] 
Cleanup: remove unused Config::ext_methods

7 years agoCleanup: remove unused wordlist API functions
Amos Jeffries [Mon, 7 Nov 2016 02:41:30 +0000 (15:41 +1300)] 
Cleanup: remove unused wordlist API functions

7 years agosecurity_file_certgen: remove useless get()
Amos Jeffries [Sun, 6 Nov 2016 15:57:02 +0000 (04:57 +1300)] 
security_file_certgen: remove useless get()

7 years agoUse Security::CertPointer in ACLServerCertificateStrategy
Amos Jeffries [Sun, 6 Nov 2016 15:54:33 +0000 (04:54 +1300)] 
Use Security::CertPointer in ACLServerCertificateStrategy

7 years agoFix missing return in HardFun functor template
Amos Jeffries [Sat, 5 Nov 2016 09:42:15 +0000 (22:42 +1300)] 
Fix missing return in HardFun functor template

7 years agoSourceFormat Enforcement
Source Maintenance [Sat, 5 Nov 2016 00:12:14 +0000 (00:12 +0000)] 
SourceFormat Enforcement

7 years agoDo not hide an already constant SBuf::id or expose its internals.
Alex Rousskov [Fri, 4 Nov 2016 22:05:07 +0000 (16:05 -0600)] 
Do not hide an already constant SBuf::id or expose its internals.

7 years agoImproved testAppendSBuf to actually test SBuf::append() optimization.
Alex Rousskov [Fri, 4 Nov 2016 22:04:34 +0000 (16:04 -0600)] 
Improved testAppendSBuf to actually test SBuf::append() optimization.

... rather than to test SBuf::id preservation across assignments
[currently used by that optimization].

Trunk r14911 talks about bitwise object copy but making sure that SBuf
has a working assignment operator is an issue unrelated to append() and
its optimization. Besides, it is not really the prohibited by C++
bitwise copy that we might worry about but the default member-wise
assignment that we may forget to customize.

7 years agoHonor SBufReservationRequirements::minSize regardless of idealSize.
Alex Rousskov [Fri, 4 Nov 2016 21:14:54 +0000 (15:14 -0600)] 
Honor SBufReservationRequirements::minSize regardless of idealSize.

In a fully specified SBufReservationRequirements, idealSize would
naturally match or exceed minSize. However, the idealSize default value
(zero) may not. We should honor minSize regardless of idealSize, just as
the API documentation promises to do.

No runtime changes expected right now because the only existing user of
SBufReservationRequirements sets .idealSize to CLIENT_REQ_BUF_SZ (4096)
and .minSize to 1024.

7 years agoSourceFormat Enforcement
Source Maintenance [Fri, 4 Nov 2016 18:12:20 +0000 (18:12 +0000)] 
SourceFormat Enforcement

7 years agoMinor polishing fixes inside tunnelPeerSelectComplete function
Christos Tsantilas [Fri, 4 Nov 2016 17:05:48 +0000 (19:05 +0200)] 
Minor polishing fixes inside tunnelPeerSelectComplete function

7 years agoFwdState::connectStart() cleanup
Christos Tsantilas [Fri, 4 Nov 2016 16:48:53 +0000 (18:48 +0200)] 
FwdState::connectStart() cleanup

 The pinned_connection->stopPinnedConnectionMonitoring() call does not needed,
it is already called from inside pinned_connection->borrowPinnedConnection
called two lines before.

This is a Measurement Factory project

7 years agoSupport tunneling of bumped non-HTTP traffic. Other SslBump fixes.
Christos Tsantilas [Fri, 4 Nov 2016 16:47:34 +0000 (18:47 +0200)] 
Support tunneling of bumped non-HTTP traffic. Other SslBump fixes.

Use case: Skype groups appear to use TLS-encrypted MSNP protocol instead
of HTTPS. This change allows Squid admins using SslBump to tunnel Skype
groups and similar non-HTTP traffic bytes via "on_unsupported_protocol
tunnel all". Previously, the combination resulted in encrypted HTTP 400
(Bad Request) messages sent to the client (that does not speak HTTP).

Also this patch:
 * fixes bug 4529: !EBIT_TEST(entry->flags, ENTRY_FWD_HDR_WAIT)
   assertion in FwdState.cc.

 * when splicing transparent connections during SslBump step1, avoid
   access-logging an extra record and log %ssl::bump_mode as the expected
   "splice" not "none".

 * handles an XXX comment inside clientTunnelOnError for possible memory
   leak of client streams related objects

 * fixes TunnelStateData logging in the case of splicing after peek.

This is a Measurement Factory project.

7 years agoOptimize appending to empty SBufs, a common use case.
Alex Rousskov [Thu, 3 Nov 2016 13:57:02 +0000 (02:57 +1300)] 
Optimize appending to empty SBufs, a common use case.

Most appends start with an empty buffer. Some append only once. There
is no reason to allocate new memory for that first append or force the
appender to write code to optimize that first append.

Why also check that SBuf has never been configured or altered then? To
preserve pre-allocated SBufs, such as those [ab]used as I/O buffers.

7 years agoTests: improve SBuf::append tests
Amos Jeffries [Thu, 3 Nov 2016 12:51:17 +0000 (01:51 +1300)] 
Tests: improve SBuf::append tests

This adds tests to verify append properly updates
the content of destination SBuf without altering
other critical internal fields (ie no bitwise copy)

7 years agoFix spelling for digest nonce cache maintenance event
Garri Djavadyan [Thu, 3 Nov 2016 03:18:09 +0000 (16:18 +1300)] 
Fix spelling for digest nonce cache maintenance event

7 years agoCleanup: use SBufList for /etc/hosts parsing
Amos Jeffries [Wed, 2 Nov 2016 04:37:37 +0000 (17:37 +1300)] 
Cleanup: use SBufList for /etc/hosts parsing

Remove one more use of wordlist in favour of SBufList

Also, fixes bug in layer-02-maximus configure options

7 years agoTests: add regression tests for cachemgr_passwd parsing
Amos Jeffries [Tue, 1 Nov 2016 13:00:30 +0000 (02:00 +1300)] 
Tests: add regression tests for cachemgr_passwd parsing

7 years agoCleanup: replace cachemgr_passwd with SBufList
Amos Jeffries [Tue, 1 Nov 2016 01:41:39 +0000 (14:41 +1300)] 
Cleanup: replace cachemgr_passwd with SBufList

Remove one more use of wordlist in favour of SBufList

Also, updates the debug warning during config parse to
use the quieter PARSE_NOTE macro.

7 years agoDocs: fix spelling errors in purge.1 manpage
Amos Jeffries [Mon, 31 Oct 2016 02:20:18 +0000 (15:20 +1300)] 
Docs: fix spelling errors in purge.1 manpage

7 years agoDocs: add mention of generate-host-certificates default change
Amos Jeffries [Mon, 31 Oct 2016 02:13:35 +0000 (15:13 +1300)] 
Docs: add mention of generate-host-certificates default change

7 years ago4.0.16 SQUID_4_0_16
Amos Jeffries [Sun, 30 Oct 2016 12:24:09 +0000 (01:24 +1300)] 
4.0.16

7 years agoBug 4627: fix generate-host-certificates and dynamic_cert_mem_cache_size defaults
Amos Jeffries [Sun, 30 Oct 2016 12:00:00 +0000 (01:00 +1300)] 
Bug 4627: fix generate-host-certificates and dynamic_cert_mem_cache_size defaults

For Squid-4 and later make these options actually do what has been documented.
Which is to generate by default with a 4MB cache.

7 years agoFix debug message in ACLChecklist::bannedAction()
Garri Djavadyan [Sun, 30 Oct 2016 06:38:32 +0000 (19:38 +1300)] 
Fix debug message in ACLChecklist::bannedAction()

7 years agoSourceFormat Enforcement
Source Maintenance [Fri, 28 Oct 2016 12:12:05 +0000 (12:12 +0000)] 
SourceFormat Enforcement

7 years agoBug 4567: Strange IPv6 shown in access.log
Amos Jeffries [Fri, 28 Oct 2016 11:55:44 +0000 (00:55 +1300)] 
Bug 4567: Strange IPv6 shown in access.log

7 years agoFix GCC 4.9 build after rev.14893
Amos Jeffries [Fri, 28 Oct 2016 08:41:57 +0000 (21:41 +1300)] 
Fix GCC 4.9 build after rev.14893

GCC 4.9 does not support some corner cases of C++11 syntax. In this case
when it is presented with default nulptr initialization of function
pointers it gets confused with 'pure virtual' initialization:

    error: invalid pure specifier (only '= 0' is allowed) before ';' token

7 years agossl::server_name ACL badly broken since inception (trunk r14008).
Christos Tsantilas [Fri, 28 Oct 2016 08:31:53 +0000 (11:31 +0300)] 
ssl::server_name ACL badly broken since inception (trunk r14008).

The original server_name code mishandled all SNI checks and some rare
host checks:

* The SNI-derived value was pointing to an already freed memory storage.
* Missing host-derived values were not detected (host() is never nil).
* Mismatches were re-checked with an undocumented "none" value
  instead of being treated as mismatches.

Same for ssl::server_name_regex.

Also set SNI for more server-first and client-first transactions.

This is a Measurement Factory project.

7 years agoHTTP: initial support for Cache-Control:immutable
Amos Jeffries [Fri, 28 Oct 2016 07:56:00 +0000 (20:56 +1300)] 
HTTP: initial support for Cache-Control:immutable

The 'immutable' cache control is a proposed standardization of
behaviour equivalent to the refresh_pattern 'ignore-reload' option.
Reducing latency delays from revalidation when an object is known not
to be updated until it expires.

When a server emits it on responses a recipient cache is expected to
treat the response as not requiring any revalidation until it becomes
stale. For the duration of its freshness period it may be used as-is
to respond to client requests - including reload (CC:max-age=0)
requests.

This initial code does not yet support preventing IMS conditional
requests behaviour when the 'immutable' signal is received.

Note that CC:no-cache in requests, and If-None-Match ETag based
conditionals can still make an 'immutable' response be irrelevant to
a particular client request. So server contact is not completely
prevented.

Use 'immutable' option in preference over the refresh_pattern
'ignore-reload' in order to track whether that override is still
relevant.

7 years agoCleanup: Remove custom StrList/link_list implementation
Amos Jeffries [Fri, 28 Oct 2016 01:37:51 +0000 (14:37 +1300)] 
Cleanup: Remove custom StrList/link_list implementation

Use FIFO queue STL container instead.

7 years agoSourceFormat Enforcement
Source Maintenance [Thu, 27 Oct 2016 12:12:18 +0000 (12:12 +0000)] 
SourceFormat Enforcement

7 years agoRefactor acl/RegexData to use SBufList in place of wordlist
Francesco Chemolli [Thu, 27 Oct 2016 07:08:28 +0000 (08:08 +0100)] 
Refactor acl/RegexData to use SBufList in place of wordlist

7 years agoMerge from trunk
Francesco Chemolli [Thu, 27 Oct 2016 07:05:49 +0000 (08:05 +0100)] 
Merge from trunk

7 years agoClarify some variable names, use const-ref in iterations when possible
Francesco Chemolli [Thu, 27 Oct 2016 07:03:21 +0000 (08:03 +0100)] 
Clarify some variable names, use const-ref in iterations when possible

7 years agoClean debug up, use emplace_back in place of push_back in several cases
Francesco Chemolli [Wed, 26 Oct 2016 23:17:42 +0000 (00:17 +0100)] 
Clean debug up, use emplace_back in place of push_back in several cases

7 years agoDo not include worlist.h
Francesco Chemolli [Wed, 26 Oct 2016 20:11:34 +0000 (21:11 +0100)] 
Do not include worlist.h

7 years agoRefactor wordlist to SBufList in ACLRegexData
Francesco Chemolli [Wed, 26 Oct 2016 20:07:59 +0000 (21:07 +0100)] 
Refactor wordlist to SBufList in ACLRegexData

7 years agoCleanup: use C++11 initializers for some DiskThreads classes
Amos Jeffries [Wed, 26 Oct 2016 18:17:55 +0000 (07:17 +1300)] 
Cleanup: use C++11 initializers for some DiskThreads classes

Fixes AIOCounts wrong values due to uninitialized struct.

Fixes wrong pointer initialization in squidaio_ctrl_t.

7 years agoCopyright: add some missing blurbs and contributor details
Amos Jeffries [Wed, 26 Oct 2016 11:46:52 +0000 (00:46 +1300)] 
Copyright: add some missing blurbs and contributor details

7 years agoHTTP/1.1: make Vary:* objects cacheable
Amos Jeffries [Tue, 25 Oct 2016 08:03:32 +0000 (21:03 +1300)] 
HTTP/1.1: make Vary:* objects cacheable

Under new clauses from RFC 7231 section 7.1.4 and HTTP response
containing header Vary:* (wifcard variant) can be cached, but
requires revalidation with server before each use.

Use the new mandatory revalidation flags to allow storing of any
wildcard Vary:* response.

Note that responses with headers like Vary:A,B,C,* are equivalent
to Vary:*. The cache key string for these objects is normalized.

7 years agoCleanup: convert AclDenyInfoList and AclNameList to MEMPROXY_CLASS
Amos Jeffries [Mon, 24 Oct 2016 12:46:35 +0000 (01:46 +1300)] 
Cleanup: convert AclDenyInfoList and AclNameList to MEMPROXY_CLASS

Use the C++ new/delete operators provided by MEMPROXY_CLASS and
associated as-needed pool creation instead of C Alloc/Free
functions and pre-initialized pool.

Remove now unused MEM_ACL_DENY_INFO_LIST and MEM_ACL_NAME_LIST
memory pools.

Remove apparently unused DenyInfoList global.

Fixes a memory leak on shutdown/reconfigure when
aclDestroyDenyInfoList() frees a list of AclDenyInfoList object
but not the AclNameList objects attached to them.

Fixes a memory leak when reconfigure frees a list of AclDenyInfoList
objects but not the URL/page-name strings attached to them.

7 years agoFix bug introduced by r14838.
Christos Tsantilas [Mon, 24 Oct 2016 08:31:40 +0000 (11:31 +0300)] 
Fix bug introduced by r14838.

Squid crashed because HttpMsg::body_pipe was used without check that it
was initialized. The message lacks body pipe when it has no body or
empty body.