]> git.ipfire.org Git - thirdparty/squid.git/log
thirdparty/squid.git
9 years agoStore API and layout polishing. No functionality changes intended.
Alex Rousskov [Wed, 18 Nov 2015 05:46:36 +0000 (22:46 -0700)] 
Store API and layout polishing. No functionality changes intended.

This first step towards bug #7 fix focuses on fixing "any Store is a
Root" API that forced us to bloat the base Store class with methods
needed only in Store::Root() Controller.

We resolved about 15 XXXs and 10 TODOs (although these counts are
inflated by many duplicated/repeated problems). We added a few new
XXXs and TODOs as well, but they are just marking already problematic
code, not adding more problems or genuinely new work.

Class renaming and source file movement map:

  src/SwapDir.h => src/store/Disk.h (and Controller.h)
  src/SwapDir.cc => src/store/Disk.cc
  src/StoreHashIndex.h => src/store/Disks.h (and LocalSearch.h)
  src/store_dir.cc => src/store/Controller.cc (and Disks.cc, LocalSearch.cc)
  src/disk.* => src/fs_io.*

The code movement to files in parenthesis is not tracked by bzr
because bzr cannot track file splits, and most of the moved code had
to be split across multiple files to untangle various messes. When
deciding what to tell "bzr mv", we picked file pairs that would allow
us to track the most complex, most voluminous code but there is
probably no single correct way to do that.

src/disk.* files were renamed to src/fs_io.* to avoid "src/foo
conflicts with src/store/Foo" problems expected on some case-
insensitive platforms.

The Store namespace hierarchy now looks like this:

* Storage: Any storage. Similar to the old Store class, but leaner.
* Controller: Combined memory/disks caches and transients. Root API.
* Controlled: Memory cache, disk(s) cache, or transient Storage.
* Disks: All disk caches combined.
* Disk: A single cache_dir Storage.
* Memory: A memory cache.
* Transients: Entries capable of being collapsed for CF.

The last two are not moved/finalized yet, but it should not be too
difficult to do that later because there are few direct references to
them from the high-level code.

Related polishing touches:

Moved a lot of misplaced code into the right class and/or source file.

Simplified Store::search() interface to match the actual code that
does not support any search parameters. Removed the search API from
all other stores because the code did not really support store-
specific searches. Resisted the temptation to rename parameterless
search() to iterate() or similar because the actual future of this API
is murky. We may add search parameters or even remove the method
completely. This could quickly snowball into a separate project.

Removed Store::get(x,y,z) API as unused and unsupported.

Removed FreeObject() template as unused (and possibly technically
flawed).

Simplified default Store initialization/cleanup sequence. Removed
empty disk_init(). The non-default Store::Init() parameter is used by
the unit testing code only.

Simplified Store::dereference() API by moving the second parameter to
dedicated Controller::dereferenceIdle() method that is the only ones
using that parameter.

9 years agoUse "standard" STUB macros/API. Also marked the file as unused.
Alex Rousskov [Wed, 18 Nov 2015 05:38:42 +0000 (22:38 -0700)] 
Use "standard" STUB macros/API. Also marked the file as unused.

9 years agoFixed STUB_RETREF() implementation to return the right type.
Alex Rousskov [Wed, 18 Nov 2015 05:34:33 +0000 (22:34 -0700)] 
Fixed STUB_RETREF() implementation to return the right type.
Removed bogus STUB_RETREF() comment about memory leaks in _unreachable_ code.
Deprecated STUB_RETSTATREF() as essentially duplicating STUB_RETREF().

9 years agoMake RefCount pointers behave more like regular pointers.
Alex Rousskov [Wed, 18 Nov 2015 05:32:24 +0000 (22:32 -0700)] 
Make RefCount pointers behave more like regular pointers.

Allow default (but safe, thanks to C++11) conversion of RefCount
pointers to bool. This helps keep the code succinct, minimizes changes
during conversion of reference counting pointers to/from other pointer
types, and avoids nullptr/NULL differences.

9 years agoext_ldap_group_acl: fix std::cerr build error
Aymeric Vincent [Wed, 18 Nov 2015 03:30:57 +0000 (19:30 -0800)] 
ext_ldap_group_acl: fix std::cerr build error

9 years agoCombine the https_port list internal state with http_port state.
Amos Jeffries [Wed, 18 Nov 2015 03:23:59 +0000 (19:23 -0800)] 
Combine the https_port list internal state with http_port state.

These two lists have been near identical for some time now and we can
easily reduce code by simply merging the two and using either the
secure.encryptTransport flag or the transport.protocol type to select
the remaining non-identical code paths.

9 years agoPrevent all TUNNELs being marked as ABORTED
Amos Jeffries [Tue, 17 Nov 2015 10:14:15 +0000 (02:14 -0800)] 
Prevent all TUNNELs being marked as ABORTED

TUNNEL transactions are naturally ended by one of the client or server
closing the connection. This is not an abort. So finish the CONNECT
message context cleanly when the tunnel is closed.

9 years agoupdate docs for finished()
Amos Jeffries [Tue, 17 Nov 2015 08:18:25 +0000 (00:18 -0800)] 
update docs for finished()

9 years agoSplit kick() out of finished(), making terminateAll() cleaner
Amos Jeffries [Tue, 17 Nov 2015 08:14:47 +0000 (00:14 -0800)] 
Split kick() out of finished(), making terminateAll() cleaner

9 years agoDocument bug in clientTunnelOnError
Amos Jeffries [Tue, 17 Nov 2015 07:06:50 +0000 (23:06 -0800)] 
Document bug in clientTunnelOnError

9 years agoRemove unnecessary and dangerous terminateAll()
Amos Jeffries [Tue, 17 Nov 2015 06:58:37 +0000 (22:58 -0800)] 
Remove unnecessary and dangerous terminateAll()

9 years agoUpdate docs and make pop() check the context being removed
Amos Jeffries [Tue, 17 Nov 2015 06:50:47 +0000 (22:50 -0800)] 
Update docs and make pop() check the context being removed

9 years agoDocs: update ConnStateData::kick() comment
Amos Jeffries [Tue, 17 Nov 2015 06:39:08 +0000 (22:39 -0800)] 
Docs: update ConnStateData::kick() comment

9 years agoDocs: Update ConnStateData and ClientServerContext descriptions
Amos Jeffries [Tue, 17 Nov 2015 05:58:08 +0000 (21:58 -0800)] 
Docs: Update ConnStateData and ClientServerContext descriptions

9 years agoMerged from trunk rev.14401
Amos Jeffries [Tue, 17 Nov 2015 04:24:26 +0000 (20:24 -0800)] 
Merged from trunk rev.14401

9 years agoRename ClientSocketContext::connIsFinished() to finished()
Amos Jeffries [Tue, 17 Nov 2015 03:50:31 +0000 (19:50 -0800)] 
Rename ClientSocketContext::connIsFinished() to finished()

Removes some needless mentions of "conn" and clarifies that the method
handles the context object and transaction finishing, not the connection
it belongs to.

9 years agoUse connIsFinished() when a transaction is completed successfully
Amos Jeffries [Tue, 17 Nov 2015 03:26:01 +0000 (19:26 -0800)] 
Use connIsFinished() when a transaction is completed successfully

initiateClose() may sound okay, but it actually is the error handling logic.
It will terminate the ConnStateData with an erro rmessage, leaving the completed
request in the pipeline which in turn will result in *_ABORTED being logged for
all requests with Connection:close headers even if they are cleanly finished.

connIsFinished() is (now) the clean way to finish ClientSocketContext objects
lifetime regardless of whether keep-alive is needed. The ConnStateData::kick()
will now handle that so we do not even need to call keepaliveNextRequest().

Remove the now unused ClientSocketContext::keepaliveNextRequest().

9 years agoFix delay_parameters documentation
Amos Jeffries [Tue, 17 Nov 2015 00:21:01 +0000 (16:21 -0800)] 
Fix delay_parameters documentation

9 years agoError on missing Heimdal libraries only if Heimdal was required
Amos Jeffries [Mon, 16 Nov 2015 22:51:28 +0000 (14:51 -0800)] 
Error on missing Heimdal libraries only if Heimdal was required

9 years agoStop using dangling pointers for eCAP-set custom HTTP reason phrases.
Alex Rousskov [Sun, 15 Nov 2015 17:54:58 +0000 (10:54 -0700)] 
Stop using dangling pointers for eCAP-set custom HTTP reason phrases.

Squid still does not support [external] custom reason phrases and,
hence, cannot reliably support eCAP API that sets the reason phrase to
the one supplied by the adapter.  This and r14398 changes fix [known]
regression bugs introduced by r12728 ("SourceLayout").

9 years agoFixed status code-based HTTP reason phrase for eCAP-generated messages.
Alex Rousskov [Sun, 15 Nov 2015 16:59:12 +0000 (09:59 -0700)] 
Fixed status code-based HTTP reason phrase for eCAP-generated messages.

Calling .reason() on a not-yet-set theMessage.sline object resulted in
"Init" status reason phrase for all from-scratch (i.e., not cloned)
eCAP-made HTTP responses. This fix lets Squid compute the reason phrase
based on the status code, just like Squid does for forwarded responses
(IIRC).

9 years agoCleanup pipeline handling on 1xx message sending
Amos Jeffries [Sun, 15 Nov 2015 13:42:41 +0000 (05:42 -0800)] 
Cleanup pipeline handling on 1xx message sending

9 years agoRemove unused ClientSocketContext::next member
Amos Jeffries [Sun, 15 Nov 2015 13:40:50 +0000 (05:40 -0800)] 
Remove unused ClientSocketContext::next member

9 years agoRemove last traces of ConnStateData::currentobject
Amos Jeffries [Sun, 15 Nov 2015 13:36:19 +0000 (05:36 -0800)] 
Remove last traces of ConnStateData::currentobject

9 years agoReplace ClientSocketContext::removeFromConnectionList() with Pipeline::pop()
Amos Jeffries [Sun, 15 Nov 2015 13:33:44 +0000 (05:33 -0800)] 
Replace ClientSocketContext::removeFromConnectionList() with Pipeline::pop()

9 years agoReplace ConnStateData::getCurrentContext() with Pipeline::front()
Amos Jeffries [Sun, 15 Nov 2015 13:24:11 +0000 (05:24 -0800)] 
Replace ConnStateData::getCurrentContext() with Pipeline::front()

9 years agoRemove ClientSocketContext::deRegisterWithConn()
Amos Jeffries [Sun, 15 Nov 2015 12:47:04 +0000 (04:47 -0800)] 
Remove ClientSocketContext::deRegisterWithConn()

Merge with ClientSocketContext::connIsFinished(). Completing transactions
is the proper way to get requests de-queued.

9 years agoSplit ConnStateData manipulation out of ClientSocketContext::keepaliveNextRequest()
Amos Jeffries [Sun, 15 Nov 2015 12:39:27 +0000 (04:39 -0800)] 
Split ConnStateData manipulation out of ClientSocketContext::keepaliveNextRequest()

 ... move it to a ConnStateData::kick() method instead. Which is called
whenever a transaction is completed and the front queued context changes.

9 years agoReplace ConnStateData::notifyAllContexts() with Pipeline::terminateAll()
Amos Jeffries [Sun, 15 Nov 2015 12:02:50 +0000 (04:02 -0800)] 
Replace ConnStateData::notifyAllContexts() with Pipeline::terminateAll()

9 years agoReplace ConnStateData::freeAllContexts() with Pipeline::terminateAll(0)
Amos Jeffries [Sun, 15 Nov 2015 11:08:29 +0000 (03:08 -0800)] 
Replace ConnStateData::freeAllContexts() with Pipeline::terminateAll(0)

9 years agoRemove ConnStateData::areAllContextsForThisConnection()
Amos Jeffries [Sun, 15 Nov 2015 10:43:52 +0000 (02:43 -0800)] 
Remove ConnStateData::areAllContextsForThisConnection()

9 years agoReplace ConnStateData::getConcurrentRequestCount() with pipeline methods
Amos Jeffries [Sun, 15 Nov 2015 10:40:52 +0000 (02:40 -0800)] 
Replace ConnStateData::getConcurrentRequestCount() with pipeline methods

9 years agoReplace ConnStateData::addContextToQueue() with Pipeline::add()
Amos Jeffries [Sun, 15 Nov 2015 10:16:35 +0000 (02:16 -0800)] 
Replace ConnStateData::addContextToQueue() with Pipeline::add()

9 years agoUse pipeline object for transaction accounting
Amos Jeffries [Sun, 15 Nov 2015 09:55:45 +0000 (01:55 -0800)] 
Use pipeline object for transaction accounting

9 years agoUse pipeline stats in cachemgr reports
Amos Jeffries [Sun, 15 Nov 2015 09:45:47 +0000 (01:45 -0800)] 
Use pipeline stats in cachemgr reports

9 years agoPresent pipeline via class Server
Amos Jeffries [Sun, 15 Nov 2015 09:45:18 +0000 (01:45 -0800)] 
Present pipeline via class Server

9 years agoAdd class Pipeline with API for handling client request pipelines
Amos Jeffries [Sun, 15 Nov 2015 02:54:32 +0000 (18:54 -0800)] 
Add class Pipeline with API for handling client request pipelines

9 years agoUpdated stale "Ssl" text to make the comment match the code again.
Alex Rousskov [Thu, 12 Nov 2015 18:45:11 +0000 (11:45 -0700)] 
Updated stale "Ssl" text to make the comment match the code again.

9 years agoBug 4372: missing template files
Christos Tsantilas [Thu, 12 Nov 2015 08:51:03 +0000 (10:51 +0200)] 
Bug 4372: missing template files

The ERR_SECURE_ACCEPT_FAIL and ERR_REQUEST_START_TIMEOUT errors apears that
have missing templates on squid startup.
Actually these errors does not produce any error page. Move them under the
TCP_RESET error in err_type.h to mark them as optional.

This is a Measurement Factory project

9 years agorefresh_pattern regression was in 3.3, not 4.0
Amos Jeffries [Tue, 10 Nov 2015 09:18:41 +0000 (01:18 -0800)] 
refresh_pattern regression was in 3.3, not 4.0

9 years agoBug 4228: links with krb5 libs despite --without options
Amos Jeffries [Tue, 10 Nov 2015 09:12:31 +0000 (01:12 -0800)] 
Bug 4228: links with krb5 libs despite --without options

9 years agoext_kerberos_ldap_group_acl: Add missing workarounds for Heimdal Kerberos
Amos Jeffries [Tue, 10 Nov 2015 02:13:13 +0000 (18:13 -0800)] 
ext_kerberos_ldap_group_acl: Add missing workarounds for Heimdal Kerberos

error_message() function is not always provided.

9 years agoFix cache_peer forceddomain= in CONNECT
Aymeric Vincent [Mon, 9 Nov 2015 21:38:44 +0000 (13:38 -0800)] 
Fix cache_peer forceddomain= in CONNECT

9 years agoSourceFormat Enforcement
Source Maintenance [Mon, 9 Nov 2015 18:12:10 +0000 (18:12 +0000)] 
SourceFormat Enforcement

9 years agoHandshake Problem during Renegotiation
Christos Tsantilas [Mon, 9 Nov 2015 16:24:34 +0000 (18:24 +0200)] 
Handshake Problem during Renegotiation

Here is what happens:

   - Squid receives TLS Hello from the client (TCP connection A).
   - Squid successfully negotiates an TLS connection with the origin server
     (TCP connection B).
   - Squid successfully negotiates an TLS connection with the client
     (TCP connection A).
   - Squid marks connection B as "idle" and waits an HTTP request from
     connection A.
   - The origin server continues talking to Squid (TCP connection B).
     Squid detects a network read on an idle connection and closes TCP
     connection B (and then the associated TCP connection A as well).

This patch:
   - When squid detects a network read on server idle connection do an
     SSL_read to:
       a) see if application data received from server and abort in this case
       b) detect possible TLS error, or TLS shutdown message from server
       c) or ignore if only TLS protocol related packets received.

This is a Measurement Factory project

9 years agoQuieten ALE missing messages
Amos Jeffries [Sun, 8 Nov 2015 22:54:47 +0000 (14:54 -0800)] 
Quieten ALE missing messages

9 years agoFix compile erorr on clang undefined reference to '__atomic_load_8'
Amos Jeffries [Sun, 8 Nov 2015 15:09:16 +0000 (07:09 -0800)] 
Fix compile erorr on clang undefined reference to '__atomic_load_8'

Later versions of GCC on some architectures push atomic functions
out into a separate atomic library. Older versions of clang do not
handle that automatically and require the library to be linked
explicitly.

Add a check for when this is required and set ATOMICLIB if needed.

9 years agoBug 4371: compile errors: no such file or directory: DiskIO/*/*DiskIOModule.o
Amos Jeffries [Sun, 8 Nov 2015 13:32:16 +0000 (05:32 -0800)] 
Bug 4371: compile errors: no such file or directory: DiskIO/*/*DiskIOModule.o

9 years agoSourceFormat Enforcement
Source Maintenance [Sat, 7 Nov 2015 12:12:13 +0000 (12:12 +0000)] 
SourceFormat Enforcement

9 years agoSplit core Server operations from ConnStateData
Amos Jeffries [Sat, 7 Nov 2015 12:08:33 +0000 (04:08 -0800)] 
Split core Server operations from ConnStateData

This improves the servers/libserver.la class hierarchy in
preparation for HTTP/2 and other non-HTTP/1.1 protocol support.

The basic I/O functionality of ConnStateData is moved to Server
class and a set of virtual methods designed to allow for child
class implementation of data processing operations.

No logic is changed in this patch, just symbol renaming and
moving of method logics as-is into libservers.la

9 years agoFix SSL_get_certificate() problem detection
Stuart Henderson [Sat, 7 Nov 2015 06:30:27 +0000 (22:30 -0800)] 
Fix SSL_get_certificate() problem detection

The autoconf check for SQUID_SSLGETCERTIFICATE_BUGGY fails on ssl library
builds which don't include SSLv3; as a result of the autoconf decision
this can end up triggering the assert(0) in Ssl::verifySslCertificate()
in ssl/support.cc (line 1712 in 3.5.11).

9 years agoSourceFormat Enforcement
Source Maintenance [Fri, 6 Nov 2015 18:12:11 +0000 (18:12 +0000)] 
SourceFormat Enforcement

9 years agoAllow unlimited LDAP search filter for ext_ldap_group_acl helper.
Christos Tsantilas [Fri, 6 Nov 2015 17:08:02 +0000 (19:08 +0200)] 
Allow unlimited LDAP search filter for ext_ldap_group_acl helper.

The LDAP search filter in ext_ldap_group_acl is limited to 256 characters.
In some environments the user DN or group filter can be larger than this
limitation.
This patch uses dynamic allocated buffers for LDAP search filters.

This is a Measurement Factory project

9 years agoDocument new members and classes, and other minor fixes
Christos Tsantilas [Fri, 6 Nov 2015 16:37:01 +0000 (18:37 +0200)] 
Document new members and classes, and other minor fixes

9 years agoRestrict the number of downloaded certificates and the nested certificates
Christos Tsantilas [Fri, 6 Nov 2015 12:50:21 +0000 (14:50 +0200)] 
Restrict the number of downloaded certificates and the nested certificates
downloads per SSL connection

- Do not allow more than Ssl::PeerConnector::MaxCertsDownloads downloaded
  certificates for each SSL connection. This variable set to 10 for now.
- Restrict the number of nested certificates downloads. For example
  when the certificate located in an SSL site which requires to download a
  a missing certificate (... from an SSL site which requires to download a
  missing certificate )*

9 years agoFix variable clone shadowing method symbol
Amos Jeffries [Fri, 6 Nov 2015 10:06:53 +0000 (02:06 -0800)] 
Fix variable clone shadowing method symbol

9 years agoConvert cacheDigestInit to method
Amos Jeffries [Fri, 6 Nov 2015 09:35:26 +0000 (01:35 -0800)] 
Convert cacheDigestInit to method

9 years agoConvert cacheDigestBitUtil to a method
Amos Jeffries [Fri, 6 Nov 2015 07:34:54 +0000 (23:34 -0800)] 
Convert cacheDigestBitUtil to a method

Also, convert from int output to double. Avoiding implicit cast wrap,
overflow and signed/unsigned data inaccuracy.

9 years agoConvert add/remove functions to methods
Amos Jeffries [Thu, 5 Nov 2015 18:23:13 +0000 (10:23 -0800)] 
Convert add/remove functions to methods

9 years agoHandle resummed sessions
Christos Tsantilas [Thu, 5 Nov 2015 18:20:01 +0000 (20:20 +0200)] 
Handle resummed sessions

On resumed sessions the SSL server will send a "Change Cipher Spec Protocol"
message instead of Certificates message.
After the CCS protocol message received we waiting an Finished SSL handshake
message. However this message may received encrypted and we can not decrypt it
in order to parse it correctly.

This patch after the CCS message received finishes parsing.

However maybe still messages from server must received and appended to
ServerBio::rbuf in order to sent later on SSL client in the case of splice.

This patch get back the ServerBio::record_ mechanism which is enabled/disabled
by the caller Ssl::PeekingPeerConnector class. The ServerBio code writes to
ServerBio::rbuf buffer as long as the ServerBio::record_ flag is set to true
by the Ssl::PeekingPeerConnector.

9 years agoConvert cacheDigestCalcMaskSize and cacheDigestTest to methods
Amos Jeffries [Thu, 5 Nov 2015 18:13:31 +0000 (10:13 -0800)] 
Convert cacheDigestCalcMaskSize and cacheDigestTest to methods

9 years agoInternal requests (eg comming from Downloader) must not peek-and-spliced
Christos Tsantilas [Thu, 5 Nov 2015 18:03:05 +0000 (20:03 +0200)] 
Internal requests (eg comming from Downloader) must not peek-and-spliced

- Do not use the Ssl::PeekingPeerConnector to connect to remote site for
  internal HTTPS requests, peek-and-splice does not make any sense when the
  client is missing. Use the Ssl::BlindPeerConnector instead.
- Fix Ssl::BlindPeerConnector to work with requests comming from Downloader:
   * Use the default Config.ssl_client.sslContext as SSL_CTX context for
     these requests
   * Allow Ssl::BlindPeerConnector work with requests does not destined to a
     cache peer

9 years agoThe X509_check_issued is wrongly used in findCertByIssuerSlowly function.
Christos Tsantilas [Thu, 5 Nov 2015 17:41:07 +0000 (19:41 +0200)] 
The X509_check_issued is wrongly used in findCertByIssuerSlowly function.

9 years agoRemove unnecessary modification of bits_per_entry
Amos Jeffries [Thu, 5 Nov 2015 17:01:26 +0000 (09:01 -0800)] 
Remove unnecessary modification of bits_per_entry

9 years agoMake cacheDigestChangeCap() a method
Amos Jeffries [Thu, 5 Nov 2015 16:58:09 +0000 (08:58 -0800)] 
Make cacheDigestChangeCap() a method

* Rename to updateCapacity(int)

* Also, use updateCapacity() instead of *Init() to construct the digest

9 years agoConvert cacheDigestClear() to method
Amos Jeffries [Thu, 5 Nov 2015 16:27:43 +0000 (08:27 -0800)] 
Convert cacheDigestClear() to method

9 years agoPolished cache_peer_access and related documentation.
Alex Rousskov [Thu, 5 Nov 2015 15:50:04 +0000 (08:50 -0700)] 
Polished cache_peer_access and related documentation.

Admins complained that it is not clear how cache_peer_access is
evaluated and how it interacts with cache peer selection algorithms.

9 years agoConvert cacheDigestClone() to member
Amos Jeffries [Thu, 5 Nov 2015 15:37:50 +0000 (07:37 -0800)] 
Convert cacheDigestClone() to member

9 years agoMove cacheDigestDestroy to CacheDigest destructor
Amos Jeffries [Thu, 5 Nov 2015 14:10:02 +0000 (06:10 -0800)] 
Move cacheDigestDestroy to CacheDigest destructor

9 years agoRemove now useless include in mem/old_api.cc
Amos Jeffries [Thu, 5 Nov 2015 13:32:30 +0000 (05:32 -0800)] 
Remove now useless include in mem/old_api.cc

9 years agoConvert CacheDigest to MEMPROXY_CLASS
Amos Jeffries [Thu, 5 Nov 2015 12:55:45 +0000 (04:55 -0800)] 
Convert CacheDigest to MEMPROXY_CLASS

* Convert cacheDigestCreate to CacheDigest constructor

* Update cacheDigestDestroy to use delete operator

9 years agoBug 4374: refresh_pattern config parser (%)
Amos Jeffries [Wed, 4 Nov 2015 16:42:55 +0000 (08:42 -0800)] 
Bug 4374: refresh_pattern config parser (%)

9 years agoMake FATAL messages have a consistent prefix
Amos Jeffries [Tue, 3 Nov 2015 14:42:13 +0000 (06:42 -0800)] 
Make FATAL messages have a consistent prefix

9 years agoBug 4373: assertion failed: client_side_request.cc:1709: 'calloutContext->redirect_st...
Amos Jeffries [Tue, 3 Nov 2015 13:05:03 +0000 (05:05 -0800)] 
Bug 4373: assertion failed: client_side_request.cc:1709: 'calloutContext->redirect_state == REDIRECT_NONE'

9 years ago4.0.2 SQUID_4_0_2
Amos Jeffries [Sun, 1 Nov 2015 12:17:11 +0000 (04:17 -0800)] 
4.0.2

9 years agoPrep for 4.0.2 and 3.5.11
Amos Jeffries [Sun, 1 Nov 2015 10:20:12 +0000 (02:20 -0800)] 
Prep for 4.0.2 and 3.5.11

9 years agoFix shutdown aborts after rev.14374
Amos Jeffries [Sun, 1 Nov 2015 10:07:41 +0000 (02:07 -0800)] 
Fix shutdown aborts after rev.14374

Changes to signal processing introduced by rev.14374 causse Squid to
ignore repeated signals.

However, repeated shutdown signals actually has meaning and need to abort
the shutdown delay timeout. So we need to allow those through to the
shutdown signal handler.

9 years agoBug 3574: To avoid crashes, prohibit reconfiguration during shutdown.
Alex Rousskov [Fri, 30 Oct 2015 20:38:57 +0000 (14:38 -0600)] 
Bug 3574: To avoid crashes, prohibit reconfiguration during shutdown.

Also consolidated and polished signal action handling code:

1. For any executed action X, clear do_X at the beginning of action X
   code because once we start X, we should accept/queue more X
   requests (or inform the admin if we reject them).

2. Delay any action X requested during startup or reconfiguration
   because the latter two actions modify global state that X depends
   on. Inform the admin that the requested action is being delayed.

3. Cancel any action X requested during shutdown. We cannot run X
   during shutdown because shutdown modifies global state that X
   depends on, and we never come back from shutdown so there is no
   point in delaying X. Inform the admin that the requested action is
   canceled.

The child signal handling action is exempt from rules #2 and #3
because its code does not depend on Squid state.

Repeated failed attempts to fix crashes related to various overlapping
actions confirm that this code is a lot trickier than it looks. This
change introduces a more systematic/comprehensive approach to
resolving associated conflicts compared to previous ad hoc attempts.

These changes were not inspired by bug 3574 but they provide a
more comprehensive version of the earlier bug 3574 fix (r14354).

9 years agoAdd Locker friend class to SBuf for protection against memory issues
Amos Jeffries [Fri, 30 Oct 2015 12:59:17 +0000 (05:59 -0700)] 
Add Locker friend class to SBuf for protection against memory issues

When appending or otherwise modifying an SBuf based on a SBuf& or char*
the parameter used may be pointing at the MemBlob memory buffer
indirectly without holding a separate ref-count lock to it.

If 'this' SBuf then requires reallocation for any reason the char* or
buffer pointer taken from the SBuf&, which is being manipulated may in
fact be left pointing at invalid memory.

Utilize a private Locker class to create relatively cheap ref-count locks
on the store_ MemBlob when this problem MAY occur. This Locker needs to
be used on all non-const SBuf methods accepting char* or SBuf& argument.

9 years agoAudit updates
Amos Jeffries [Thu, 29 Oct 2015 23:08:05 +0000 (16:08 -0700)] 
Audit updates

9 years agoAdd Locker friend class to SBuf for protection against memory issues
Amos Jeffries [Thu, 29 Oct 2015 18:53:48 +0000 (11:53 -0700)] 
Add Locker friend class to SBuf for protection against memory issues

When appending or otherwise modifying an SBuf based on a SBuf& or char*
the parameter used may be pointing at the MemBlob memory buffer
indirectly without holding a separate ref-count lock to it.

If 'this' SBuf then requires reallocation for any reason the char* or
buffer pointer taken from the SBuf&, which is being manipulated may in
fact be left pointing at invalid memory.

Utilize a private Locker class to create relatively cheap ref-count locks
on the store_ MemBlob when this problem MAY occur. This Locker needs to
be used on all non-const SBuf methods accepting char* or SBuf& argument.

9 years agoMigrate squidaio_ctrl_t to MEMPROXY_CLASS
Francesco Chemolli [Thu, 29 Oct 2015 08:38:29 +0000 (09:38 +0100)] 
Migrate squidaio_ctrl_t to MEMPROXY_CLASS

9 years agoExpose Pool use count in Mem::AllocatorProxy (and MEMPROXY_CLASS)
Francesco Chemolli [Thu, 29 Oct 2015 08:37:13 +0000 (09:37 +0100)] 
Expose Pool use count in Mem::AllocatorProxy (and MEMPROXY_CLASS)

9 years agoRewrote ServerHello parsing using a [binary] tokenizer approach.
Alex Rousskov [Thu, 29 Oct 2015 06:00:15 +0000 (00:00 -0600)] 
Rewrote ServerHello parsing using a [binary] tokenizer approach.

Added nearly-protocol-agnostic BinaryTokenizer that can extract numbers
(in the commonplace network byte order or big-endian format) and opaque
fixed-size areas. The new tokenizer supports incremental parsing via
commit points and rollbacks. It is meant to be "safe" and provide
helpful debugging of parsed [packet] fields.

Declare a few RFC 5246 structures (that we need to parse) as C++ structs
in a new Rfc5246 namespace. These structures know how to "load"
themselves atomically using a BinaryTokenizer object.

Fixed SSL server parsing by separating record and "higher-level" layers.
Each layer has to be parsed using a dedicated tokenizer because
higher-level messages may be split across multiple record layer frames.

Parse and accumulate server certificates as we receive Certificate
messages.

This code is not fully polished and has several important XXXs and
TODOs.  Eventually, all SSL parsing code (at least) should be converted
to use BinaryTokenizer or equivalent.

9 years agoSupport dumping raw data in hex. Suitable for decoding with xxd -r -p.
Alex Rousskov [Thu, 29 Oct 2015 05:43:10 +0000 (23:43 -0600)] 
Support dumping raw data in hex. Suitable for decoding with xxd -r -p.

9 years agoBug 4359: assertion failure 'Comm::IsConnOpen(conn)' within ConnStateData::requestTimeout
Amos Jeffries [Tue, 27 Oct 2015 22:43:00 +0000 (15:43 -0700)] 
Bug 4359: assertion failure 'Comm::IsConnOpen(conn)' within ConnStateData::requestTimeout

9 years agoBug 4021: ext_user_regex does exact match
Michele Bergonzoni [Tue, 27 Oct 2015 17:54:19 +0000 (06:54 +1300)] 
Bug 4021: ext_user_regex does exact match

9 years agoSourceFormat Enforcement
Source Maintenance [Tue, 27 Oct 2015 06:11:56 +0000 (06:11 +0000)] 
SourceFormat Enforcement

9 years agoConnection stats, including %<lp, missing for persistent connections.
Alex Rousskov [Tue, 27 Oct 2015 03:45:40 +0000 (21:45 -0600)] 
Connection stats, including %<lp, missing for persistent connections.

The code reusing a pconn was missing a hier.note() call, resulting in 0
values logged for %<lp (local port number of the last server or peer
connection) and probably other missing stats.

Also refactored poorly copied statistics collection code to remove
duplication and always update to-server connection stats when the actual
connection becomes available.

Positive side effect: Upon setsockopt(2) failures, the tos and nfmark
fields of a pinned connection were set to the desired (but not actually
applied) values, while persistent connection fields were left intact
(and, hence, stale). Both fields are now reset to zero on failures, for
both types of connections.

9 years agoFix incorrect authentication headers on cache digest requests
Aymeric Vincent [Mon, 26 Oct 2015 02:53:30 +0000 (19:53 -0700)] 
Fix incorrect authentication headers on cache digest requests

  login=NEGOTIATE can have an additional parameter specified,
   like login=NEGOTIATE:xxx

One test added in rev.12714 does not take this case into account and it
will send a garbage "login:password" (== "NEGOTIATE:xxx") to its peer
when requesting a digest.

This is a workaround patch to remove the broken Authentication headers
entirely. Support for Negotiate to the peer on these digest requests is
still needed.

9 years agoBug 4281: copy-paste typos in src/tools.cc
Marcos Mello [Sun, 25 Oct 2015 12:35:16 +0000 (05:35 -0700)] 
Bug 4281: copy-paste typos in src/tools.cc

9 years agoBug 4188: Bumping intercepted SSL connections does not work on Solaris
Alex Rousskov [Sun, 25 Oct 2015 12:01:42 +0000 (05:01 -0700)] 
Bug 4188: Bumping intercepted SSL connections does not work on Solaris

9 years agoAvoid errors when parsing manager ACL in old squid.conf
Amos Jeffries [Fri, 23 Oct 2015 05:36:51 +0000 (22:36 -0700)] 
Avoid errors when parsing manager ACL in old squid.conf

ACL manager is now a built-in definition and has a different type. That
has been causing FATAL errors when parsing old squid.conf. We can be
nicer and just ignore the obsolete config lines.

9 years agoBug 4356: segmentation fault using proxy_auth ACL
Amos Jeffries [Fri, 23 Oct 2015 04:10:43 +0000 (21:10 -0700)] 
Bug 4356: segmentation fault using proxy_auth ACL

9 years agoFetch missing certificates.
Alex Rousskov [Thu, 22 Oct 2015 18:34:42 +0000 (12:34 -0600)] 
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 adds a similar feature to Squid:
   - Parse Server Hello messages and extract certificates chain.
   - Check whether the issuers of each certificate exist in the chain.
   - If not, retrieve the issuer certificate URI from Authority Info
     extension of the certificate (if it is provided) and download the
     certificate.
   - Store downloaded certificates in Squid object cache, just like any
     other HTTP object.

Implementation highlights:
  - A new Downloader class allows Squid subsystems to download objects
    via HTTP. These downloads are not backed by a proxy user.
  - Add support for an internal database of intermediate pre-loaded
    certificates to be used to complete incomplete chains.
  - Ssl::HandshakeParser parses TLS records and TLS Handshake messages.
  - Ssl::PeerConnector now uses the Downloader objects to download
    missing certificates.

9 years agoFixed chunked parsing by mimicking psChunkEnd state removed in trunk r14108.
Alex Rousskov [Wed, 21 Oct 2015 11:59:13 +0000 (04:59 -0700)] 
Fixed chunked parsing by mimicking psChunkEnd state removed in trunk r14108.

... or, more precisely, in r13994.1.4 (parser-ng-chunked: re-write parse
sequence using ParseState stages instead of Step method pointers). Before
parser-ng-chunked, reaching zero theLeftBodySize would switch the chunk
parser to the psChunkEnd state. It was possible to pause parsing in that
state and resume it when more data becomes available, including the CRLF that
follows the chunk data. After parser-ng-chunked, the state remains
HTTP_PARSE_CHUNK which implies positive theLeftBodySize.

9 years agoRe-assign delay pools based on HTTP reply details
Vitaly Lavrov [Wed, 21 Oct 2015 11:45:35 +0000 (04:45 -0700)] 
Re-assign delay pools based on HTTP reply details

9 years agoBug 4351: compile errors when authentication modules disabled
Amos Jeffries [Fri, 16 Oct 2015 14:28:52 +0000 (07:28 -0700)] 
Bug 4351: compile errors when authentication modules disabled

Authentication modules can be selectively disabled. This means the module
header files need to be wrapped with disable macros, and also code that
depends on module internal definitions.

9 years agoBug 4352: compile errors in OS X 10.11
Amos Jeffries [Fri, 16 Oct 2015 10:53:48 +0000 (03:53 -0700)] 
Bug 4352: compile errors in OS X 10.11

9 years ago1xx response terminates Squid-to-server connection, breaking many PUTs.
Alex Rousskov [Thu, 15 Oct 2015 02:52:58 +0000 (19:52 -0700)] 
1xx response terminates Squid-to-server connection, breaking many PUTs.

Since trunk revision 13688.1.6 (Use Http1::ResponseParser to process
HTTP server responses), HttpStateData::processReplyHeader() sets
flags.headers_parsed after successfully parsing a 1xx control message.
The rest of the code interprets that flag as "parsed the final response"
and throws a !flags.headers_parsed exception because we have not parsed
the final (non-1xx) response yet. The exception kills virtually any PUT
or similar transaction that triggers an HTTP 100 (Continue) response
from the origin server.

This fix restores the original position of the flags.headers_parsed
update.