]> git.ipfire.org Git - thirdparty/squid.git/log
thirdparty/squid.git
7 years agoCleanup: remove unused Ipc::MemMap::ttl
Amos Jeffries [Mon, 8 Aug 2016 23:20:36 +0000 (11:20 +1200)] 
Cleanup: remove unused Ipc::MemMap::ttl

 Detected by Coverity Scan. Issue 1364747

7 years agoCleanup: make static analysis a bit happier
Amos Jeffries [Mon, 8 Aug 2016 17:51:44 +0000 (05:51 +1200)] 
Cleanup: make static analysis a bit happier

Use return after self_destruct() to make code path analysis a bit better.

 Detected by Coverity Scan. Issue 1154203

7 years agoFix eCAP build error after rev.14778
Eduard Bagdasaryan [Mon, 8 Aug 2016 10:40:57 +0000 (22:40 +1200)] 
Fix eCAP build error after rev.14778

7 years agoCleanup: make static analyzers happier
Amos Jeffries [Sat, 6 Aug 2016 06:06:27 +0000 (18:06 +1200)] 
Cleanup: make static analyzers happier

Coverity and other static analyers are not smart enough to detect that
self_destruct() does not return.SO get confused about NULL derefernces.

 Coverity Scan. Issues 1364730136472713647241364729, 434088.

7 years agoCleanup: check URN list before using it
Amos Jeffries [Sat, 6 Aug 2016 05:55:37 +0000 (17:55 +1200)] 
Cleanup: check URN list before using it

The check should not be needed, the URN parse function always allocates.
But do it at the right time even so.

 Detected by Coverity Scan. Issue 434062

7 years agoFix clang errors with global InstanceId initialization
Amos Jeffries [Sat, 6 Aug 2016 04:49:55 +0000 (16:49 +1200)] 
Fix clang errors with global InstanceId initialization

Move static member Last into change() method to avoid initialization order
errors when a caller uses a global InstanceId object before the library
instantiating its template is initialized.

Also, convert the Prefix static member to a constant string in a prefix()
method to avoid the same issue there.

7 years agoCleanup: remove some minor memory leaks on config parser self_destruct
Amos Jeffries [Fri, 5 Aug 2016 22:00:51 +0000 (10:00 +1200)] 
Cleanup: remove some minor memory leaks on config parser self_destruct

 Identified by Coverity Scan. ID 13647421364744.

7 years ago4.0.13 SQUID_4_0_13
Amos Jeffries [Fri, 5 Aug 2016 12:51:46 +0000 (00:51 +1200)] 
4.0.13

7 years agoBug 4551: fix exceptions in new chunked decoder
Amos Jeffries [Tue, 2 Aug 2016 15:06:37 +0000 (03:06 +1200)] 
Bug 4551: fix exceptions in new chunked decoder

... fixing incremental CRLF parsing in both chunked encoding and
status-line parsing contexts.

7 years agoTry fix "'fatal' was not declared in this scope" compile error after r14769
Christos Tsantilas [Mon, 1 Aug 2016 13:57:14 +0000 (16:57 +0300)] 
Try fix "'fatal' was not declared in this scope" compile error after r14769

7 years agoSourceFormat Enforcement
Source Maintenance [Mon, 1 Aug 2016 12:12:15 +0000 (12:12 +0000)] 
SourceFormat Enforcement

7 years agoBug 4555: Minor improvements to error pages CSS
Marcos Mello [Mon, 1 Aug 2016 11:40:09 +0000 (23:40 +1200)] 
Bug 4555: Minor improvements to error pages CSS

7 years agoFetch missing certificates
Christos Tsantilas [Mon, 1 Aug 2016 11:27:44 +0000 (14:27 +0300)] 
Fetch missing certificates

Many web servers do not have complete certificate chains. Many browsers use
certificate extensions of the server certificate and download the missing
intermediate certificates automatically from the Internet.
This patch add this feature to Squid.

The information for missing issuer certificates provided by the Authority
Information Access X509 extension. This describes the format and the location
of additional information provided by the issuer of the certificate.

This patch:
  - Implements a class Downloader as an independet AsyncJob class. This new
    class can be used by internal squid subsystems to download objects from
    the network.
  - Modify Ssl::PeerConnector class to use new Downloader class to
    retrieve missing certificates from the net. The URIs of missing
    certificates from the Authority Information Access X509 extension.
  - Implements a new basic certificates parser based on openSSL for the
    TLS handshake messages parser.
  - Modify the Ssl::ServerBio class to:
     * Buffer the Server Hello message and not pass it to the openSSL library
       until downloading missing certificates, if any, is finished.
     * Extract server certificates from server hello message.
       This is required to check if there are missing certificates, and if yes
       give the chance to squid to download missing certificates and complete
       certificate chains before pass them for processing to openSSL

TODO:
  - Add support for certs-only CMS message.
    From  RFC 4325:
    "Where the information is available via HTTP or FTP, accessLocation
    MUST be a uniformResourceIdentifier and the URI MUST point to either
    a single DER encoded certificate as specified in [RFC2585] or a
    collection of certificates in a BER or DER encoded "certs-only" CMS
    message as specified in [RFC2797]. "
    ...
    "Conforming applications that support HTTP or FTP for accessing
    certificates MUST be able to accept individual DER encoded
    certificates and SHOULD be able to accept "certs-only" CMS messages."

This is a Measurement Factory project

7 years agomerge from trunk-r14768
Christos Tsantilas [Mon, 1 Aug 2016 11:11:47 +0000 (14:11 +0300)] 
merge from trunk-r14768

7 years agoPolishing fixes from squid-dev review
Christos Tsantilas [Mon, 1 Aug 2016 09:42:45 +0000 (12:42 +0300)] 
Polishing fixes from squid-dev review

7 years agoFix crash after rev.14735
Alex Rousskov [Sat, 30 Jul 2016 19:55:15 +0000 (07:55 +1200)] 
Fix crash after rev.14735

7 years agoFix Certificate Validator buffer-overflow crashes Squid (commit r14757)
Christos Tsantilas [Fri, 29 Jul 2016 08:31:12 +0000 (11:31 +0300)] 
Fix Certificate Validator buffer-overflow crashes Squid (commit r14757)

- In the case of unexpected or timedout helper replies we must ignore the
  current message untill an eom found.

- Inside helperStatefulHandleRead, the current Helper::Xaction can be NULL
  in the case of unexpected helper reply.

This is a Measurement Factory Project

7 years agoCleanup: remove useless dead #include lines
Amos Jeffries [Wed, 27 Jul 2016 21:20:40 +0000 (09:20 +1200)] 
Cleanup: remove useless dead #include lines

7 years agoCleanup: sort stub_libsecurity
Amos Jeffries [Wed, 27 Jul 2016 21:16:35 +0000 (09:16 +1200)] 
Cleanup: sort stub_libsecurity

7 years agoTLS: do not hang when 'connector' fails
Amos Jeffries [Wed, 27 Jul 2016 12:24:50 +0000 (00:24 +1200)] 
TLS: do not hang when 'connector' fails

7 years agoSourceFormat Enforcement
Source Maintenance [Wed, 27 Jul 2016 12:12:14 +0000 (12:12 +0000)] 
SourceFormat Enforcement

7 years agoCleanup: Move PeerConnector and BlindPeerConnector to libsecurity
Amos Jeffries [Wed, 27 Jul 2016 11:06:57 +0000 (23:06 +1200)] 
Cleanup: Move PeerConnector and BlindPeerConnector to libsecurity

Just namespace renaming and redux of USE_OPENSSL wrapped code sections.

7 years agoSquid segfault via Ftp::Client::readControlReply().
Christos Tsantilas [Wed, 27 Jul 2016 08:18:03 +0000 (11:18 +0300)] 
Squid segfault via Ftp::Client::readControlReply().

Ftp::Client::scheduleReadControlReply(), which may called from the
asynchronous start() or readControlReply()/handleControlReply()
handlers, does not check whether the control connection is still usable
before using it.

This is a Measurement Factory project.

7 years agoSourceFormat Enforcement
Source Maintenance [Mon, 25 Jul 2016 12:12:06 +0000 (12:12 +0000)] 
SourceFormat Enforcement

7 years agoCertificate Validator buffer-overflow crashes Squid part2: fix 'make check' errors
Christos Tsantilas [Mon, 25 Jul 2016 11:24:12 +0000 (14:24 +0300)] 
Certificate Validator buffer-overflow crashes Squid part2: fix 'make check' errors

7 years agokerberos_ldap_group: support SSL/TLS used to connect to an LDAP server
Markus Moeller [Mon, 25 Jul 2016 10:59:47 +0000 (22:59 +1200)] 
kerberos_ldap_group: support SSL/TLS used to connect to an LDAP server

Also, apply code formatting

7 years agoCertificate Validator buffer-overflow crashes Squid
Christos Tsantilas [Mon, 25 Jul 2016 10:22:54 +0000 (13:22 +0300)] 
Certificate Validator buffer-overflow crashes Squid

Certain server certificates with a large chain and/or large certificates
(i.e. due to excessive amount of SAN entries) are producing helper requests and
replies which are larger than the 32KB limit set in src/helper.cc.

The major problem for squid is that the helper response should fit in the
helper read buffer. Currently squid starts with 4K request buffer and if
required may increase the buffer size up to 32K.

This patch:
  - Uses a constant-size read buffer for helpers and accumulates the helper
    response to Helper::Reply object.
  - Changes the HelperServerBase::requests list to hold list of the new
    Helper::Xaction class which holds pairs of Helper::Request and
    Helper::Reply objects
  - Modifies the Helper::Reply class to accumulate data and restricts the
    required memory allocations

This is a Measurement Factory project

7 years agoFix clang 'smpAware' overrides a member function but is not marked 'override'
Amos Jeffries [Sun, 24 Jul 2016 06:30:24 +0000 (18:30 +1200)] 
Fix clang 'smpAware' overrides a member function but is not marked 'override'

7 years agoCollapse internal revalidation requests (SMP-unaware caches).
Eduard Bagdasaryan [Sat, 23 Jul 2016 13:36:56 +0000 (01:36 +1200)] 
Collapse internal revalidation requests (SMP-unaware caches).

... also address Bug 4311 and partially address Bug 2833 and Bug 4471.

Extend collapsed_forwarding functionality to internal revalidation
requests. This implementation does not support Vary-controlled cache
objects and is limited to SMP-unaware caching environments, where each
Squid worker knows nothing about requests and caches handled by other
workers. However, it also lays critical groundwork for future SMP-aware
collapsed revalidation support.

Prior to these changes, multiple concurrent HTTP requests for the same
stale cached object always resulted in multiple internal revalidation
requests sent by Squid to the origin server. Those internal requests
were likely to result in multiple competing Squid cache updates, causing
cache misses and/or more internal revalidation requests, negating
collapsed forwarding savings.

Internal cache revalidation requests are collapsed if and only if
collapsed_forwarding is enabled. There is no option to control just
revalidation collapsing because there is no known use case for it.

* Public revalidation keys

Each Store entry has a unique key. Keys are used to find entries in the
Store (both already cached/swapped_out entries and not). Public keys are
normally tied to the request method and target URI. Same request
properties normally lead to the same public key, making cache hits
possible. If we were to calculate a public key for an internal
revalidation request, it would have been the same as the public key of
the stale cache entry being revalidated. Adding a revalidation response
to Store would have purged that being-revalidated cached entry, even if
the revalidation response itself was not cachable.

To avoid purging being-revalidated cached entries, the old code used
private keys for internal revalidation requests. Private keys are always
unique and cannot accidentally purge a public entry. On the other hand,
for concurrent [revalidation] requests to find the store entry to
collapse on, that store entry has to have a public key!

We resolved this conflict by adding "scope" to public keys:

* Regular/old public keys have default empty scope (that does not affect
  key generation). The code not dealing with collapsed revalidation
  continues to work as before. All entries stored in caches continue to
  have the same keys (with an empty scope).

* When collapsed forwarding is enabled, collapsable internal
  revalidation requests get public keys with a "revalidation" scope
  (that is fed to the MD5 hash when the key is generated). Such a
  revalidation request can find a matching store entry created by
  another revalidation request (and collapse on it), but cannot clash
  with the entry being revalidated (because that entry key is using a
  different [empty] scope).

This change not only enables collapsing of internal revalidation
requests within one worker, but opens the way for SMP-aware workers to
share information about collapsed revalidation requests, similar to how
those workers already share information about being-swapped-out cache
entries.

After receiving the revalidation response, each collapsed revalidation
request may call updateOnNotModified() to update the stale entry [with
the same revalidation response!]. Concurrent entry updates would have
wasted many resources, especially for disk-cached entries that support
header updates, and may have purged being-revalidated entries due to
locking conflicts among updating transactions. To minimize these
problems, we adjusted header and entry metadata updating logic to skip
the update if nothing have changed since the last update.

Also fixed Bug 4311: Collapsed forwarding deadlocks for SMP Squids using
SMP-unaware caches. Collapsed transactions stalled without getting a
response because they were waiting for the shared "transients" table
updates. The table was created by Store::Controller but then abandoned (not
updated) by SMP-unaware caches. Now, the transients table is not created
at all unless SMP-aware caches are present. This fix should also address
complaints about shared memory being used for Squid instances without
SMP-aware caches.

A combination of SMP-aware and SMP-unaware caches is still not supported
and is likely to stall collapsed transactions if they are enabled. Note
that, by default, the memory cache is SMP-aware in SMP environments.

7 years agoQuieten digest oversize warnings
Amos Jeffries [Sat, 23 Jul 2016 06:02:56 +0000 (18:02 +1200)] 
Quieten digest oversize warnings

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

7 years agoFix some failed transactions not being logged.
Eduard Bagdasaryan [Fri, 22 Jul 2016 19:37:12 +0000 (07:37 +1200)] 
Fix some failed transactions not being logged.

There are situations when Squid logs nothing to access.log after an
[abnormal] transaction termination. Such "stealthy" transactions may be
a security risk and an accounting problem.

ClientHttpRequest is responsible for logging most transactions but that
object is created only after the HTTP request headers are successfully
parsed. Request header parsing errors may be detected and logged
appropriately, but the job handling the incoming transaction may
terminate for reasons outside the parsing code control (e.g., a job-
killing exception thrown when there are no request headers to start
parsing yet or when the job waits for more request headers to finishing
parsing).

This change adds access logging for three cases:

1. accept(2) system call errors (before ConnStateData job is created).

2. Unexpected ConnStateData job termination, when there is no
   ClientHttpRequest to log the failure.

3. Connections which send no bytes: these connections drain Squid
   resources and, hence, should be logged.
   TODO: make this behavior configurable because some browsers are known to
   routinely create such connections(and, hence, logging them may create
   too much noise in some environments).

7 years agoAdd stub for log/liblog symbols
Amos Jeffries [Fri, 22 Jul 2016 13:19:36 +0000 (01:19 +1200)] 
Add stub for log/liblog symbols

7 years agoAdd missing 'tls' option for cache_peer
Amos Jeffries [Fri, 22 Jul 2016 08:38:30 +0000 (20:38 +1200)] 
Add missing 'tls' option for cache_peer

7 years agoCleanup: remove XSTD_USE_LIBLTDL, which has not been needed in a long while.
Amos Jeffries [Wed, 20 Jul 2016 14:33:14 +0000 (02:33 +1200)] 
Cleanup: remove XSTD_USE_LIBLTDL, which has not been needed in a long while.

7 years agoRevert changes in rev.14726
Amos Jeffries [Mon, 18 Jul 2016 12:36:38 +0000 (00:36 +1200)] 
Revert changes in rev.14726

7 years agoCleanup: drop redundant parse buffer check
Eduard Bagdasaryan [Sun, 17 Jul 2016 09:03:05 +0000 (21:03 +1200)] 
Cleanup: drop redundant parse buffer check

7 years agoFix error: taking the absolute value of unsigned type after rev.14739
Amos Jeffries [Sat, 16 Jul 2016 11:13:00 +0000 (23:13 +1200)] 
Fix error: taking the absolute value of unsigned type after rev.14739

7 years agoSourceFormat Enforcement
Source Maintenance [Fri, 15 Jul 2016 18:12:18 +0000 (18:12 +0000)] 
SourceFormat Enforcement

7 years agomake the Downloader::CbDialer a CallDialer kid
Christos Tsantilas [Fri, 15 Jul 2016 14:06:44 +0000 (17:06 +0300)] 
make the Downloader::CbDialer a CallDialer kid

7 years agoremove XXX comments from PeerConnector related to Downloader: they are not valid...
Christos Tsantilas [Fri, 15 Jul 2016 13:28:48 +0000 (16:28 +0300)] 
remove XXX comments from PeerConnector related to Downloader: they are not valid any more

7 years agoCleanup: remove unused references to SquidList.h
Amos Jeffries [Fri, 15 Jul 2016 13:13:03 +0000 (01:13 +1200)] 
Cleanup: remove unused references to SquidList.h

7 years agocall setLogUri to set url if no adaptation is used
Christos Tsantilas [Fri, 15 Jul 2016 13:12:09 +0000 (16:12 +0300)] 
call setLogUri to set url if no adaptation is used

7 years agoCleanup: use std::queue for UFS file I/O queues
Amos Jeffries [Fri, 15 Jul 2016 13:09:18 +0000 (01:09 +1200)] 
Cleanup: use std::queue for UFS file I/O queues

7 years agoSquid-dev review comments by Alex and Amos
Christos Tsantilas [Fri, 15 Jul 2016 11:05:34 +0000 (14:05 +0300)] 
Squid-dev review comments by Alex and Amos

7 years agoCleanup: TunnelStateData switchToTunnel function
Amos Jeffries [Wed, 13 Jul 2016 12:59:17 +0000 (00:59 +1200)] 
Cleanup: TunnelStateData switchToTunnel function

7 years agoCleanup: PeerConnector session initialization method
Amos Jeffries [Wed, 13 Jul 2016 12:39:22 +0000 (00:39 +1200)] 
Cleanup: PeerConnector session initialization method

* rename initializeSsl() method to initializeTls()

* use SessionPointer instead of SessionPtr

* return value is best used in boolean expressions, so make it bool
  this also resolves some template issues with SessionPointer return type.

* rename the session parameter to serverSession which better documents what
  it is than 'ssl', and distinguishes it from clientSession in child methods
  which have to deal with both.

7 years agoFix error: 'storeDigestRegisterWithCacheManager' was not declared
Amos Jeffries [Wed, 13 Jul 2016 11:31:50 +0000 (23:31 +1200)] 
Fix error: 'storeDigestRegisterWithCacheManager' was not declared

7 years agoBug 4534: assertion failure in xcalloc when using many cache_dir
Amos Jeffries [Tue, 12 Jul 2016 16:15:51 +0000 (04:15 +1200)] 
Bug 4534: assertion failure in xcalloc when using many cache_dir

7 years agoDocumentation, polishing and fixes
Christos Tsantilas [Mon, 11 Jul 2016 15:34:28 +0000 (18:34 +0300)] 
Documentation, polishing and fixes

 - Add/fix basic documentation for Downloader and DownloaderContext classes
 - Move DownloaderContext class definition to Downloader.cc file
 - fix cbdata leaks inside DownloaderCotnext destructor, caused by simple typo
   mistake.
 - Do not cbdatalock the ClientHttpRequest object inside DownloaderContext.
   This class is responsible to hold the main pointer and finaly delete the
   ClientHttpRequest object.

7 years agoCleanup: Ssl::Create*() functions
Amos Jeffries [Mon, 11 Jul 2016 10:57:11 +0000 (22:57 +1200)] 
Cleanup: Ssl::Create*() functions

* return value is only used in boolean expressions, so make it bool

* pass Comm::ConnectionPointer instead of raw-FD value

7 years agobasic_db_auth: add support for unsalted SHA1 passwords
jltallon [Fri, 8 Jul 2016 12:30:01 +0000 (00:30 +1200)] 
basic_db_auth: add support for unsalted SHA1 passwords

7 years agoSourceFormat Enforcement
Source Maintenance [Fri, 8 Jul 2016 12:12:14 +0000 (12:12 +0000)] 
SourceFormat Enforcement

7 years agoReplaced TidyPointer with std::unique_ptr.
Amos Jeffries [Fri, 8 Jul 2016 11:26:40 +0000 (23:26 +1200)] 
Replaced TidyPointer with std::unique_ptr.

LockingPointer is now a stand-alone class that is understood (and
documented) as a typical shared pointer with OpenSSL-friendly object
importing methods. Replaced its TidyPointer::reset() abuse with an
explicit resetWithoutLocking() method after reviewing that all such
calls needed no locking indeed.

7 years agoPolish from final audit
Amos Jeffries [Fri, 8 Jul 2016 06:24:33 +0000 (18:24 +1200)] 
Polish from final audit

7 years agoMerged from trunk rev.14734
Amos Jeffries [Thu, 7 Jul 2016 19:03:02 +0000 (07:03 +1200)] 
Merged from trunk rev.14734

7 years agoSync with trunk r14734
Christos Tsantilas [Thu, 7 Jul 2016 08:17:21 +0000 (11:17 +0300)] 
Sync with trunk r14734

7 years agoReplace LockingPointer::reset with resetWithoutLocking
Amos Jeffries [Tue, 5 Jul 2016 23:37:12 +0000 (11:37 +1200)] 
Replace LockingPointer::reset with resetWithoutLocking

This required the GnuTLS and void session pointer definitions being made
to use LockingPointer.

Also, use std::move assignment instead of X.reset(Y.release()) pattern.

7 years agoCleanup: make createStaticServerContext deal with ContextPointer
Amos Jeffries [Tue, 5 Jul 2016 17:00:36 +0000 (05:00 +1200)] 
Cleanup: make createStaticServerContext deal with ContextPointer

This method is about initializing the staticContext member of
ServerOptions. There is no need to involve the caller directly in those
logistics.

7 years agoBug 4542: authentication credentials IP TTL updated incorrectly
Anonymous [Tue, 5 Jul 2016 05:45:44 +0000 (17:45 +1200)] 
Bug 4542: authentication credentials IP TTL updated incorrectly

7 years agoUpdate LockingPointer methods and documentation
Amos Jeffries [Mon, 4 Jul 2016 15:21:08 +0000 (03:21 +1200)] 
Update LockingPointer methods and documentation

7 years agoBug 4540: revert r14720 buffer update
Amos Jeffries [Sat, 2 Jul 2016 06:47:55 +0000 (18:47 +1200)] 
Bug 4540: revert r14720 buffer update

7 years agoAdd missing dereference operator in TidyPointer
Amos Jeffries [Fri, 1 Jul 2016 17:35:00 +0000 (05:35 +1200)] 
Add missing dereference operator in TidyPointer

7 years ago4.0.12 SQUID_4_0_12
Amos Jeffries [Fri, 1 Jul 2016 13:25:33 +0000 (01:25 +1200)] 
4.0.12

7 years agoSourceFormat Enforcement
Source Maintenance [Fri, 1 Jul 2016 12:12:10 +0000 (12:12 +0000)] 
SourceFormat Enforcement

7 years agoPrep for 4.0.12 and 3.5.20
Amos Jeffries [Fri, 1 Jul 2016 11:30:00 +0000 (23:30 +1200)] 
Prep for 4.0.12 and 3.5.20

7 years agoAdd missing STUBS for rev.14726
Amos Jeffries [Fri, 1 Jul 2016 11:12:09 +0000 (23:12 +1200)] 
Add missing STUBS for rev.14726

7 years agoGnuTLS: support for TLS session resume
Amos Jeffries [Thu, 30 Jun 2016 22:10:55 +0000 (10:10 +1200)] 
GnuTLS: support for TLS session resume

7 years agoBug 4523: smblib compile fails on NetBSD
Ian Clark [Thu, 30 Jun 2016 19:33:14 +0000 (07:33 +1200)] 
Bug 4523: smblib compile fails on NetBSD

7 years agoPolish: remove unnecessary 'this->' usage in LockingPointer
Amos Jeffries [Thu, 30 Jun 2016 18:10:33 +0000 (06:10 +1200)] 
Polish: remove unnecessary 'this->' usage in LockingPointer

7 years agoCleanup: use C++11 auto when starting ::Server jobs
Amos Jeffries [Thu, 30 Jun 2016 12:37:25 +0000 (00:37 +1200)] 
Cleanup: use C++11 auto when starting ::Server jobs

7 years agoBug 4376: clang cannot build Squid eCAP code
Patrick Welche [Wed, 29 Jun 2016 17:24:24 +0000 (11:24 -0600)] 
Bug 4376: clang cannot build Squid eCAP code

This change is not needed for libecap v1.0 that uses tr1::shared_ptr.
However, libecap is being updated to use std::shared_ptr. Once that
update is complete, Squid eCAP code will no longer compile because the
implicit conversion of shared_ptr to bool in tr1 was deemed dangerous
and, hence, made "explicit" when shared_ptr became standard. Unlike "if"
statements, "return" statements do not trigger an explicit conversion.

7 years agoRemove UnaryFunctor as well, use std::function instead
Amos Jeffries [Wed, 29 Jun 2016 10:44:40 +0000 (22:44 +1200)] 
Remove UnaryFunctor as well, use std::function instead

7 years agosecurity_file_certgen: convert xfree_char to UnaryFunctor xfree_functor
Amos Jeffries [Tue, 28 Jun 2016 12:57:49 +0000 (00:57 +1200)] 
security_file_certgen: convert xfree_char to UnaryFunctor xfree_functor

7 years agoRename UniaryFunctor to UnaryFunctor
Amos Jeffries [Tue, 28 Jun 2016 12:37:16 +0000 (00:37 +1200)] 
Rename UniaryFunctor to UnaryFunctor

7 years agoClang does not provide a global nullptr_t symbol
Amos Jeffries [Mon, 27 Jun 2016 15:54:25 +0000 (03:54 +1200)] 
Clang does not provide a global nullptr_t symbol

7 years agoMerge form trunk rev.14722
Amos Jeffries [Sun, 26 Jun 2016 15:30:29 +0000 (03:30 +1200)] 
Merge form trunk rev.14722

7 years agoFix build error in ESI after rev.14721
Amos Jeffries [Sun, 26 Jun 2016 15:29:44 +0000 (03:29 +1200)] 
Fix build error in ESI after rev.14721

7 years agoMerged from trunk rev.14721
Amos Jeffries [Sun, 26 Jun 2016 14:11:59 +0000 (02:11 +1200)] 
Merged from trunk rev.14721

7 years agoRename CtoCppDtor() as UniaryFunctor()
Amos Jeffries [Sun, 26 Jun 2016 10:41:32 +0000 (22:41 +1200)] 
Rename CtoCppDtor() as UniaryFunctor()

Update the filename, and output functor name suffix to match.

7 years agoRemove last remains of TidyPointer
Amos Jeffries [Sat, 25 Jun 2016 18:02:09 +0000 (06:02 +1200)] 
Remove last remains of TidyPointer

7 years agoRestore old move-assignment definition
Amos Jeffries [Sat, 25 Jun 2016 15:23:43 +0000 (03:23 +1200)] 
Restore old move-assignment definition

We cannot use the compilers default move assignment operator since we
have custom deletePointer() happening in the reset() call.

7 years agoHTTP/1.1: Update all stored headers on 304 revalidation.
Eduard Bagdasaryan [Sat, 25 Jun 2016 14:35:41 +0000 (02:35 +1200)] 
HTTP/1.1: Update all stored headers on 304 revalidation.

According to RFC 7234 section 4.3.4. when a proxy receives 304 (Not Modified)
response, it should update every header, except Warning headers (which need
special processing). Also RFC 7232 section 4.1. does not prohibit origin servers
from sending any headers in 304 responses. That means that Squid now should not
ignore headers, which earlier were considered as malicious/faulty.

7 years agoMigrate TidyPointer to std::unique_ptr
Amos Jeffries [Fri, 24 Jun 2016 12:32:41 +0000 (00:32 +1200)] 
Migrate TidyPointer to std::unique_ptr

7 years agosecurity_file_certgen: use std::unique_ptr instead of TidyPointer
Amos Jeffries [Fri, 24 Jun 2016 12:01:31 +0000 (00:01 +1200)] 
security_file_certgen: use std::unique_ptr instead of TidyPointer

7 years agoConvert Http::Stream::reqbuf to a MemBlob, making it configurable at runtime.
Nathan Hoad [Fri, 24 Jun 2016 05:29:44 +0000 (17:29 +1200)] 
Convert Http::Stream::reqbuf to a MemBlob, making it configurable at runtime.

This also makes many other auxilary changes:

 * Increases the size of Http::Stream::requestBuffer to match that of
   read_ahead_gap. Previously this was a 4kb fixed size buffer. As a result,
   the overhead for a single client connection has been increased by 12 KB in
   the default configuration, but Squid will no longer artifically slow down
   client responses in this situation by fragmenting the read(2)/write(2)
   calls.

 * Improves the performance of large uncacheable replies. This was achieved by
   increasing the buffer size to 16 KB as mentioned above, but it is worth
   mentioning separately. Specifically, for a server, client and proxy all
   running on my local machine, this patch increases throughput on a 5 GB file
   from ~110 MB/s to ~340 MB/s.

 * Documents the influence that read_ahead_gap had on the size of read(2) calls
   for HTTP, and now the size of write(2) calls.

 * Prevent read_ahead_gap from being set to 0. Previously this would result in
   hung requests.

This work is submitted on behalf of Bloomberg L.P.

7 years agoCleanup: separate TidyPointer and LockingPointer
Amos Jeffries [Thu, 23 Jun 2016 17:05:30 +0000 (05:05 +1200)] 
Cleanup: separate TidyPointer and LockingPointer

By cut-n-pasting the TidyPointer API into LockingPointer
and removing the inheritence.

7 years agoSync with trunk rev.14719
Amos Jeffries [Thu, 23 Jun 2016 02:08:56 +0000 (14:08 +1200)] 
Sync with trunk rev.14719

7 years agoWipe initial experiments
Amos Jeffries [Thu, 23 Jun 2016 02:07:23 +0000 (14:07 +1200)] 
Wipe initial experiments

7 years agoBug 4532: pid_filename not working as documented
Amos Jeffries [Mon, 20 Jun 2016 12:50:59 +0000 (00:50 +1200)] 
Bug 4532: pid_filename not working as documented

7 years agoSourceFormat Enforcement
Source Maintenance [Fri, 17 Jun 2016 18:12:11 +0000 (18:12 +0000)] 
SourceFormat Enforcement

7 years agoAssertion failed: Write.cc:38: "fd_table[conn->fd].flags.open"
Christos Tsantilas [Fri, 17 Jun 2016 17:37:22 +0000 (20:37 +0300)] 
Assertion failed: Write.cc:38: "fd_table[conn->fd].flags.open"

The Ftp::Server::stopWaitingForOrigin() notification may come after
Ftp::Server (or an external force) has started closing the control
connection but before the Ftp::Server job became unreachable for
notifications. Writing a response in this state leads to assertions.

Other, currently unknown paths may lead to the same write-after-close
problems. This change protects all asynchronous notification methods
(except the connection closure handler itself) from exposing underlying
code to a closing control connection. This is very similar to checking
for ERR_CLOSING in Comm handlers.

This is a Measurement Factory project.

7 years agoRemove impossible condition from rev.14715
Amos Jeffries [Fri, 17 Jun 2016 17:13:44 +0000 (05:13 +1200)] 
Remove impossible condition from rev.14715

7 years agoUnit test for SBuf::reserve()
Amos Jeffries [Fri, 17 Jun 2016 16:29:29 +0000 (04:29 +1200)] 
Unit test for SBuf::reserve()

7 years agoDo not make bogus recvmsg(2) calls when closing UDS sockets.
Alex Rousskov [Wed, 15 Jun 2016 15:37:44 +0000 (09:37 -0600)] 
Do not make bogus recvmsg(2) calls when closing UDS sockets.

comm_empty_os_read_buffers() assumes that all non-blocking
FD_READ_METHODs can read into an opaque buffer filled with random
characters. That assumption is wrong for UDS sockets that require an
initialized msghdr structure. Feeding random data to recvmsg(2) leads to
confusing errors, at best. Squid does not log those errors, but they
are visible in, for example, strace:

  recvmsg(17, 0x7fffbb, MSG_DONTWAIT) = -1 EMSGSIZE (Message too long)

comm_empty_os_read_buffers() is meant to prevent TCP RST packets. The
function now ignores UDS sockets that are not used for TCP.

TODO: Useless reads may also exist for UDP and some TCP sockets.

7 years agoBug 4504: Too many WARNING: Ignoring error setting CA certificate locations
Amos Jeffries [Wed, 15 Jun 2016 14:31:34 +0000 (02:31 +1200)] 
Bug 4504: Too many WARNING: Ignoring error setting CA certificate locations

7 years agoSourceFormat Enforcement
Source Maintenance [Tue, 14 Jun 2016 18:12:14 +0000 (18:12 +0000)] 
SourceFormat Enforcement

7 years agoBug 4516: security_file_certgen man page update
Marcos Mello [Tue, 14 Jun 2016 17:36:04 +0000 (05:36 +1200)] 
Bug 4516: security_file_certgen man page update

7 years agoFixed Server::maybeMakeSpaceAvailable() logic.
Alex Rousskov [Tue, 14 Jun 2016 16:54:23 +0000 (04:54 +1200)] 
Fixed Server::maybeMakeSpaceAvailable() logic.

This change fixes logic bugs that mostly affect performance: In micro-
tests, this change gives 10% performance improvement for intercepted
"fast peek at SNI and splice" SslBump configurations. Similar
improvement is expected for future plain HTTP/2 parsers.

maybeMakeSpaceAvailable() is called with an essentially random inBuf.
The method must prepare inBuf for the next network read. The old code
was not doing that [well enough], leading to performance problems.

In some environments, inBuf often ends up having tiny space exceeding 2
bytes (e.g., 6 bytes). This happens, for example, when Squid creates and
parses a fake CONNECT request. The old code often left such tiny inBufs
"as is" because we tried to ensure that we have at least 2 bytes to read
instead of trying to provide a reasonable number of buffer space for the
next network read. Tiny buffers naturally result in tiny network reads,
which are very inefficient, especially for non-incremental parsers.

I have removed the explicit "2 byte" space checks: Both the new and the
old code do not _guarantee_ that at least 2 bytes of buffer space are
always available, and the caller does not check that condition either.
If some other code relies on it, more fixes will be needed (but this
change is not breaking that guarantee -- either it was broken earlier or
was never fully enforced). In practice, only buffers approaching
Config.maxRequestBufferSize limit may violate this guarantee AFAICT, and
those buffers ought to be rare, so the bug, if any, remains unnoticed.

Another subtle maybeMakeSpaceAvailable() problem was that the code
contained its own buffer capacity increase algorithm (n^2 growth).
However, increasing buffer capacity exponentially does not make much
sense because network read sizes are not going to increase
exponentially. Also, memAllocStringmemAllocate() overwrites n^2 growth
with its own logic. Besides, it is buffer _space_, not the total
capacity that should be increased. More work is needed to better match
Squid buffer size for from-user network reads with the TCP stack buffers
and traffic patterns.

Both the old and the new code reallocate inBuf MemBlobs. However, the
new code leaves "reallocate or memmove" decision to the new
SBuf::reserve(), opening the possibility for future memmove
optimizations that SBuf/MemBlob do not currently support.

It is probably wrong that inBuf points to an essentially random MemBlob
outside Server control but this change does not attempt to fix that.

7 years agoTLS Authority Key Identifier certificate extension
Christos Tsantilas [Tue, 14 Jun 2016 15:56:12 +0000 (18:56 +0300)] 
TLS Authority Key Identifier certificate extension

This patch add support for mimicking TLS Authority Key Identifier certificate
extension in Squid generated TLS certificates: If the origin server certificate
has that extension, the generated certificate (via the ssl_crtd daemon or
internally) should have the same extension, with the same set of fields if
possible.

This is a Measurement Factory project