]> git.ipfire.org Git - thirdparty/squid.git/log
thirdparty/squid.git
12 years agoBug 3686: cache_dir max-size default fails
Amos Jeffries [Sat, 9 Feb 2013 00:44:07 +0000 (17:44 -0700)] 
Bug 3686: cache_dir max-size default fails

If some cache_dir are configured with max-size and some not the default
maximum_object_size limit fails.

This refactors the max-size management code such that each SwapDir always
has a value maxObjectSize(). This value is calculated from the SwapDir
local setting or global limit as appropriate.

The global maximum_object_size directive is migrated to simply be a default
for cache_dir max-size= option.

The global store_maxobjsize variable is altered to be the overall global
limit on how big an object may be cache by this proxy. It now takes into
account the max-size for all cache_dir and cache_mem limitation.

NP: The slow accumulation of these and earlier changes means Squid no
longer immediately caches unknown-length objects. The unit-tests are
therefore changed to test using explicit 0-length objects to ensure the
test is on a cached object not bypassing the apparently ested logic.
They are also provided with a large global store_maxobjsize limit in order
to do a weak test of the SwapDir types max-size in the presence of other
larger cache_dir or maximum_object_size settings.

12 years agoproper fix for stub HttpRequest
Amos Jeffries [Fri, 8 Feb 2013 14:00:26 +0000 (03:00 +1300)] 
proper fix for stub HttpRequest

12 years agoBug 3767: tcp_outgoing_* ACLs do not obey acl_uses_indirect_client
Nick Rogers [Fri, 8 Feb 2013 12:24:38 +0000 (05:24 -0700)] 
Bug 3767: tcp_outgoing_* ACLs do not obey acl_uses_indirect_client

12 years agoDocs: handle unknown squid-2.7 directives cleaner
Amos Jeffries [Fri, 8 Feb 2013 11:58:57 +0000 (00:58 +1300)] 
Docs: handle unknown squid-2.7 directives cleaner

This uses the squid-3 'obsolete' directive logics to cleanly accept and
warn about squid-2.7 directives which are not yet ported to squid-3.

12 years agoFix missing HttpRequest stub for storeId()
Amos Jeffries [Fri, 8 Feb 2013 11:38:05 +0000 (00:38 +1300)] 
Fix missing HttpRequest stub for storeId()

12 years agoPolish debugs on more obsolete options
Amos Jeffries [Fri, 8 Feb 2013 11:30:24 +0000 (00:30 +1300)] 
Polish debugs on more obsolete options

12 years agoRemove useless conditional in announce_period
Tianyin Xu [Fri, 8 Feb 2013 09:50:17 +0000 (22:50 +1300)] 
Remove useless conditional in announce_period

12 years agoAdd custom Store ID code support
Eliezer Croitoru [Fri, 8 Feb 2013 09:25:04 +0000 (02:25 -0700)] 
Add custom Store ID code support

This is a port of the StoreURL feature from Squid-2.7 rewritten to avoid
the unfortunate link that 2.7 feature had with URL-rewriting.

The feature uses a helper to retrieve custom ID values for use in the
cache storage ID key. The default ID used is the requested URL.

Differences since 2.7:
* storeurl_* directive names are now called store_id_*

* The helper response now expects 'OK store-id="..."\n'
  However the squid-2.7 response syntax is still accepted.

* the ID value presented need not be a URL. Although URL syntax
  is recommended to simplify store log interpretation and
  refresh pattern matching.

* refresh_pattern applies to the store ID, not the request URL.

TODO: support store ID lookups on ICP and HTCP queries.

12 years agoMake squid -z for cache_dir rock work like UFS instead of like COSS.
Alex Rousskov [Fri, 8 Feb 2013 04:14:50 +0000 (21:14 -0700)] 
Make squid -z for cache_dir rock work like UFS instead of like COSS.
Polish -z documentation and cache.log reporting.

When a startup script runs squid -z by mistake against a cache_dir that is
already initialized and full of cached entries, some admins prefer that
nothing happens. Rock store now skips reinitialization if both the cache_dir
directory and the db file in that directory exist. If one or both are missing,
the missing pieces are created.

UFS does something similar because it creates missing L1 and L2 directories
but does not erase any entries already present in the cache_dir path. COSS,
OTOH, re-initializes the existing db. Rock behavior will now be closer to UFS.

To clean a corrupted cache_dir, the admin must remove its top-level directory
before running squid -z.

Squid now logs "Creating missing swap directories" instead of "Creating Swap
Directories", and our documentation now reflects the "if missing" part of the
-z algorithm.

Also documented that recent Squid versions run -z in daemon mode (so that SMP
configuration macros continue to work).

12 years agoMigrate HttpMsg to Lock refcounting
Amos Jeffries [Tue, 5 Feb 2013 07:47:28 +0000 (20:47 +1300)] 
Migrate HttpMsg to Lock refcounting

First stage of the conversion to RefCount<>. This replaces the custom
attempt at ref-count locking in HttpMsg with the locking mechanism
presented by class Lock.

12 years agoSourceFormat Enforcement
Automatic source maintenance [Tue, 5 Feb 2013 01:13:29 +0000 (18:13 -0700)] 
SourceFormat Enforcement

12 years agoBug 3752: objects that cannot be cached in memory are not cached on disk
Alex Rousskov [Mon, 4 Feb 2013 17:39:23 +0000 (10:39 -0700)] 
Bug 3752: objects that cannot be cached in memory are not cached on disk
  if cache_dir max-size is used.

This fix contains four related changes:

1) When fixing "trimMemory for unswappable objects" (trunk r11969), we
replaced swapoutPossible() with swappingOut()||mayStartSwapOut() but missed
the fact that swapoutPossible() had "possible now" semantics while
mayStartSwapOut() has "may start now or in the future" semantics. When all
cache_dirs had max-size set, mayStartSwapOut() returned false for objects of
unknown size and even for smaller-than-maximum but not-yet-received objects,
despite the fact that those objects could be swapped out later.

That false mayStartSwapOut() result allowed maybeTrimMemory() to trim those
objects memory and mark the objects for release, preventing their subsequent
disk caching.

2) To fix (1) above, mayStartSwapOut() had to return true for not-yet-received
objects of unknown size. However, returning true is correct only if no
subsequent check can return false. Thus, we had to move all lower/later checks
that could return false up, placing them before the maximum-of-all-max-sizes
check.

3) Once (2) was done, the end of mayStartSwapOut() had (a) a loop that could
return true while setting decision to MemObject::SwapOut::swPossible and (b)
an unconditional code that did ... the same thing. Thus, the loop could no
longer change the method outcome. The loop also had a lot of doubts and XXXs
attached to it. We removed it. If that loop is needed, it is needed and must
be resurrected elsewhere.

4) Since mayStartSwapOut() returns true if swapout is possible in the future
(but not necessarily now), we cannot rely on its return value to initiate
swapout code. We need to test whether swapout.decision is swPossible instead.

12 years agoFix RefCount documentation
Francesco Chemolli [Mon, 4 Feb 2013 15:40:58 +0000 (16:40 +0100)] 
Fix RefCount documentation

12 years agoShuffle the traffic mode flags into their own structure
Amos Jeffries [Mon, 4 Feb 2013 11:12:03 +0000 (00:12 +1300)] 
Shuffle the traffic mode flags into their own structure

* ssl-bump i sincluded for now since it effectively initiates a mode of
  traffic handling on decrypted CONNECT requests or intercepted HTTPS

12 years agoImplemented TrafficMode::isIntercepted()
Francesco Chemolli [Mon, 4 Feb 2013 09:47:50 +0000 (10:47 +0100)] 
Implemented TrafficMode::isIntercepted()

12 years agoMerged from trunk
Francesco Chemolli [Mon, 4 Feb 2013 08:59:59 +0000 (09:59 +0100)] 
Merged from trunk

12 years agoRelease Notes: update and spelling corrections
Amos Jeffries [Mon, 4 Feb 2013 05:55:39 +0000 (22:55 -0700)] 
Release Notes: update and spelling corrections

* Move the formal deprecation of upgrade_headers to 3.2.
* spell-check 3.2, 3.3, 3.4 release notes
* spell-check squid.conf.documented

12 years agoRemove goto from daemon: logging module
Amos Jeffries [Mon, 4 Feb 2013 04:35:07 +0000 (21:35 -0700)] 
Remove goto from daemon: logging module

 Also, this should remove a false-positive issue detected by Coverity
Scan Issue 740453.

12 years agoFix memory leaks and segmentation faults in librfcnb parser
Francesco Chemolli [Mon, 4 Feb 2013 02:52:26 +0000 (19:52 -0700)] 
Fix memory leaks and segmentation faults in librfcnb parser

 Detected by Coverity Scan. Issues 740426, 740427, 740499.

12 years agoSourceFormat Enforcement
Automatic source maintenance [Mon, 4 Feb 2013 01:19:40 +0000 (18:19 -0700)] 
SourceFormat Enforcement

12 years agoFix uninitialized class members in StoreSearchHashIndex
Amos Jeffries [Sun, 3 Feb 2013 13:51:45 +0000 (06:51 -0700)] 
Fix uninitialized class members in StoreSearchHashIndex

 Detected by Coverity Scan. Issue 740580

12 years agoFix uninitialized members in rev.12620
Amos Jeffries [Sun, 3 Feb 2013 12:23:31 +0000 (05:23 -0700)] 
Fix uninitialized members in rev.12620

 Detected by Coverity Scan. Issue 971423

12 years agoFix several uninitialized object members in unit tests
Amos Jeffries [Sun, 3 Feb 2013 10:45:53 +0000 (03:45 -0700)] 
Fix several uninitialized object members in unit tests

 Detected by Coverity Scan. Issues 740581, 740582, 740583, 740584

12 years agoFix lots of SNMP alignment, sizeof(), and memory uninitialized erorrs
Amos Jeffries [Sun, 3 Feb 2013 08:49:00 +0000 (01:49 -0700)] 
Fix lots of SNMP alignment, sizeof(), and memory uninitialized erorrs

They all stem from a few uses of "sizeof(name)" where name is a pointer
to an OID object rather than the object itself. This code is present as
far back as squid-2.6 and probably a lot further.

It appears to not have been causing obvious problems due to the
sizeof(oid*) [4 or 8 octets] on a pointer being larger than the
sizeof(oid) [1 or 2 octets] on the object stored into the allocated
memory.

 Detected by Coverity Scan. Issues 740305, 740306, 740306, 740307,
    740308, 740459, 740460, 740461, 740462, 740465, 740466, 740467,
    740468, 740469, 740470, 740471, 740472.

12 years agoPolish debugging on HelperReply parse
Eliezer Croitoru [Sun, 3 Feb 2013 05:45:19 +0000 (18:45 +1300)] 
Polish debugging on HelperReply parse

12 years agoFix segmentation fault on missing squid.conf values
Amos Jeffries [Sat, 2 Feb 2013 11:01:45 +0000 (04:01 -0700)] 
Fix segmentation fault on missing squid.conf values

Directves expecting percentage values may segfault when no value token
is supplied.

 Detected by Coverity Scan. Issue 970941

12 years agoFix parsing of max-stale values in Surrogate-Control header
Amos Jeffries [Sat, 2 Feb 2013 10:56:53 +0000 (03:56 -0700)] 
Fix parsing of max-stale values in Surrogate-Control header

Skip parsing of the max-stale field when the initial max-age value
is not a valid integer value.

 Detected by Coverity Scan. Issue 740361

12 years agoFix typos in Ident.cc
Amos Jeffries [Fri, 1 Feb 2013 14:43:35 +0000 (03:43 +1300)] 
Fix typos in Ident.cc

12 years agoext_sql_session_acl: Fix hex decoding on UID
Thomas Weber [Fri, 1 Feb 2013 11:04:40 +0000 (04:04 -0700)] 
ext_sql_session_acl: Fix hex decoding on UID

12 years agoBug 3749: IDENT lookup using wrong ports to identify the user
Amos Jeffries [Fri, 1 Feb 2013 09:34:31 +0000 (02:34 -0700)] 
Bug 3749: IDENT lookup using wrong ports to identify the user

12 years agoBug 3723: tcp_outgoing_tos/mark broken for CONNECT requests
Sebastien Wenske [Fri, 1 Feb 2013 08:46:00 +0000 (01:46 -0700)] 
Bug 3723: tcp_outgoing_tos/mark broken for CONNECT requests

12 years agoBug 3726: build errors with --disable-ssl
Amos Jeffries [Fri, 1 Feb 2013 07:06:40 +0000 (00:06 -0700)] 
Bug 3726: build errors with --disable-ssl

12 years agoBug 3515: crash in FtpStateData::ftpTimeout
Amos Jeffries [Fri, 1 Feb 2013 06:49:25 +0000 (23:49 -0700)] 
Bug 3515: crash in FtpStateData::ftpTimeout

Since revision squid-3.2-11174 restructured teh TCO connection handling
in FTP the data connection has had separate 'opener' connection.
Meaning the conn->fd state is always NULL when the setup times out.

This cleans up the data connection opener state and allows the error
message generation to take place.

12 years agoPrep for 3.2.7
Amos Jeffries [Fri, 1 Feb 2013 05:11:42 +0000 (22:11 -0700)] 
Prep for 3.2.7

12 years agoSourceFormat Enforcement
Automatic source maintenance [Fri, 1 Feb 2013 01:13:22 +0000 (18:13 -0700)] 
SourceFormat Enforcement

12 years agoFixed several ConnOpener problems
Alex Rousskov [Fri, 1 Feb 2013 00:28:16 +0000 (17:28 -0700)] 
Fixed several ConnOpener problems
by relying on AsyncJob protections and comm_close(), while maintaining a
tighter grip on various I/O and sleep states.

Problems addressed:

* Connection descriptor was not closed when attempting to reconnect after
  failures. We now properly close on failures, sleep with descriptor closed,
  and then reopen.

* Timeout handler was not cleaned up properly in some cases, causing memory
  leaks (for the handler Pointer) and possibly timeouts that were fired (for
  then-active handler) after the connection was passed to the initiator.

* Comm close handler was not cleaned up properly.

* statCounter.syscalls.sock.closes counter was not updated on FD closure.

* Waiting pending accepts were not kicked on FD closure.

* Connection timeout was enforced for each connection attempt instead of
  applying to all attempts taken together.

and possibly other problems. The full extent of all side-effects of mishandled
race conditions and state conflicts is probably unknown.

12 years agoTurned SwapDir.flags, Format::Token.flags CossMemBuf.flags, CossState.flags,
Francesco Chemolli [Thu, 31 Jan 2013 15:05:34 +0000 (16:05 +0100)] 
Turned SwapDir.flags, Format::Token.flags CossMemBuf.flags, CossState.flags,
Fs::Ufs::RebuildState.flags to bool

12 years agoRemove unused ErrorState::flags data member
Francesco Chemolli [Wed, 30 Jan 2013 18:20:45 +0000 (19:20 +0100)] 
Remove unused ErrorState::flags data member

12 years agoTurned flags to bool types for PeerDigest, RefreshPattern,
Francesco Chemolli [Wed, 30 Jan 2013 15:39:37 +0000 (16:39 +0100)] 
Turned flags to bool types for PeerDigest, RefreshPattern,
ClientHttpRequest, fde, fqdncache_entry, ipcache_entry, HelperServerBase

12 years agoSourceFormat Enforcement
Automatic source maintenance [Tue, 29 Jan 2013 01:13:20 +0000 (18:13 -0700)] 
SourceFormat Enforcement

12 years agoMimic Key Usage and Basic Constraints
Christos Tsantilas [Mon, 28 Jan 2013 17:38:00 +0000 (19:38 +0200)] 
Mimic Key Usage and Basic Constraints

There are cases where the generated certificates do not mimic enough properties
and secure connection with the client fails. For example, Squid does not mimic
Key Usage extensions. Clients using GnuTLS (or similar libraries that validate
server certificate using those extensions) fail to secure the connection with
Squid.

This patch add mimicking for the following extensions, which are considered
as safe to mimic:
    * X509v3 Key Usage
    * X509v3 Extended Key Usage,
    * X509v3 Basic Constraints CA.

We would be happy to add more "safe to mimic" extensions if users request (and
vouch for) them.

This is a Measurement Factory project

12 years agoChanged clients of RequestFlags to use bool constants; changed FwdState.flags to...
Francesco Chemolli [Mon, 28 Jan 2013 16:56:05 +0000 (17:56 +0100)] 
Changed clients of RequestFlags to use bool constants; changed FwdState.flags to bool

12 years agoTest-playground
Francesco Chemolli [Mon, 28 Jan 2013 13:24:51 +0000 (14:24 +0100)] 
Test-playground

12 years agoFix ipv6 enabled pinger.
Amos Jeffries [Mon, 28 Jan 2013 06:20:02 +0000 (23:20 -0700)] 
Fix ipv6 enabled pinger.

Was failing with assertion failure due to ipv6 support not being probed
automatically.

12 years agoSourceFormat Enforcement
Automatic source maintenance [Mon, 28 Jan 2013 01:14:56 +0000 (18:14 -0700)] 
SourceFormat Enforcement

12 years agoNo-lookup DNS ACLs
Christos Tsantilas [Sun, 27 Jan 2013 17:35:07 +0000 (19:35 +0200)] 
No-lookup DNS ACLs

Currently, dst, dstdom, dstdom_regex (and other?) DNS-related ACLs do DNS
lookups if such a lookup is needed to convert an IP address into a domain name
or vice versa. This creates two kinds of problems:

 - It is difficult to identify requests that use raw IP addresses in Request-URI
   or Host headers. One would have to use something like url_regex and possibly
   req_header to identify those before using dst ACLs to match the request
   destination against a known IP subnet. IPv6 would only make this harder.

 - It is difficult to use dst* ACLs in options that support fast ACLs only.
   If an async lookup is required, the answer will be unpredictable (now)
   or DUNNO (when the ACL bugs are fixed), possibly with warnings and other
   complications.

This patch adds a -n option to dst, dstdom, dstdom_regex and other DNS-related
ACLs. The option disable lookups and address type conversions. If lookup or
conversion is required because the parameter type (IP or domain name) does not
match the message address type (domain name or IP), then the ACL with a -n
option would immediately declare a mismatch without any warnings or lookups.

The "--" option can be used to stop processing all options, in the case the
first acl value has '-' character as first character (for example the '-' is
a valid domain name)

For example:

    # Matches requests with full URI host set to localhost
    # but not requests with full URI host set to 127.0.0.1
    acl toLocalRawName dstdom -n localhost
    http_access allow toLocalRawName

    # Use -- option to stop processing flags
    acl AnACL dst_domain -n -- -cream-and-sugar.tumblr.com

    # Matches requests with full URI host set to 127.0.0.1
    # but not requests with full URI host set to localhost
    acl toLocalRawIp dst -n 127.0.0.1/32
    cache_peer_access peer1 allow toLocalRawIp

Please note that -n prohibits lookups in Squid's DNS caches as well.

This is a Measurement Factory project

12 years agoPolish: complete constructor for class DelayBucket
Amos Jeffries [Sat, 26 Jan 2013 12:46:05 +0000 (05:46 -0700)] 
Polish: complete constructor for class DelayBucket

 Detected by Coverity Scan. Issues 740508, 740509

12 years agoBug 3687: unhandled exception: c when using interception and peers
Amos Jeffries [Sat, 26 Jan 2013 00:09:02 +0000 (17:09 -0700)] 
Bug 3687: unhandled exception: c when using interception and peers

12 years agoPolish: document unix_group helper
Amos Jeffries [Fri, 25 Jan 2013 23:53:17 +0000 (16:53 -0700)] 
Polish: document unix_group helper

12 years agoFix NULL-dereference added in rev.12611
Amos Jeffries [Fri, 25 Jan 2013 23:44:49 +0000 (16:44 -0700)] 
Fix NULL-dereference added in rev.12611

* strto*() may be called without a value parameter when used simply to
  verify the content of a string is a valid conversion.

  Detected by Coverity Scan. Issue 970939.

12 years agoRefactor type of some flags to bool
Francesco Chemolli [Fri, 25 Jan 2013 16:53:16 +0000 (17:53 +0100)] 
Refactor type of some flags to bool

Affected classes: StoreClient, mem_node, AclUserData, AclMaxUserIp,
Auth::Digest::UserRequest, digest_nonce_h

12 years agoTurn flags in CachePeer class into proper bool type.
Francesco Chemolli [Fri, 25 Jan 2013 16:01:16 +0000 (17:01 +0100)] 
Turn flags in CachePeer class into proper bool type.

12 years agoPolish: initialize the main PortCfg pointers
Amos Jeffries [Fri, 25 Jan 2013 10:52:46 +0000 (03:52 -0700)] 
Polish: initialize the main PortCfg pointers

* Only the main pointers for now, the rest can wait on some additional
  cleanup patches undergoing testing.

 Fixes defects detected by Coverity Scan. Issue 740501 and some of 740535

12 years agoPolish: complete Digest authentication constructors
Amos Jeffries [Fri, 25 Jan 2013 09:09:52 +0000 (02:09 -0700)] 
Polish: complete Digest authentication constructors

* update several Digest auth constructors to fully initialize
   their fields.

* Also, fix one segmentation fault at level 9 debug in Digest auth.

  Detected by Coverity Scan. Issues 740536, 740537, 740366.

12 years agoPolish squid.conf parsing validation
Tianyin Xu [Fri, 25 Jan 2013 01:26:21 +0000 (18:26 -0700)] 
Polish squid.conf parsing validation

* Updates ato*() functiosn to safer xato*() alternatives provided by
  the Squid compat library. Along with error messages on invalid
  configuration values detected by these.

* Add protection against integer overflow on most options

* Add parse deprecation messages on enable/disable for boolean and
  and trilean options.

* Add 'wrong-value' error messages on most options.

12 years agoBug 3111: Mid-term fix for the forward.cc "err" assertion.
Alex Rousskov [Thu, 24 Jan 2013 16:22:45 +0000 (09:22 -0700)] 
Bug 3111: Mid-term fix for the forward.cc "err" assertion.

The assert is triggered when a close handler for the server connection
destroys FwdState before we have received anything from the origin server.
Instead of asserting, we now respond with a 502 (Bad Gateway) ERR_READ_ERROR.

That error seems the most appropriate single choice among available ones, but
it may be misleading (in access.log) when the close handler was called due to
client problems. Hopefully, another error will be logged in most of those
cases.

12 years agoPropagate pinned connection persistency and closures to the client.
Christos Tsantilas [Thu, 24 Jan 2013 10:26:24 +0000 (12:26 +0200)] 
Propagate pinned connection persistency and closures to the client.

Squid was trying hard to forward a request after pinned connection failures
because some of those failures were benign pconn races. That meant re-pinning
failed connections. After a few iterations to correctly handle non-idempotent
requests, the code appeared to work, but the final design, with all the added
complexity and related dangers was deemed inferior to the approach we use now.

Squid now simply propagates connection closures (including pconn races) to the
client. It is now the client responsibility not to send non-idempotent requests
on idle persistent connections and to recover from pconn races.

Squid also propagates HTTP connection persistency indicators from client to
server and back, to make client job feasible. Squid will send Connection:close
and will close the client connection if the pinned server says so, even if
Squid could still maintain a persistent connection with the client.

These changes are not mean to affect regular (not pinned) transactions.

In access.log, one can detect requests that were not responded to (due to race
conditions on pinned connections) by searching for ERR_ZERO_SIZE_OBJECT
%err_code with TCP_MISS/000 status and zero response bytes.

This is a Measurement Factory project.

12 years agoUnshadow variables in ssl/certificate_db.cc
Francesco Chemolli [Wed, 23 Jan 2013 17:36:25 +0000 (18:36 +0100)] 
Unshadow variables in ssl/certificate_db.cc

12 years agoProperly clean up members in UFSSwapDir.
Francesco Chemolli [Wed, 23 Jan 2013 16:25:51 +0000 (17:25 +0100)] 
Properly clean up members in UFSSwapDir.

Coverity Scan issue nr. 740338

12 years agoRemove unused variable in client_side.cc
Francesco Chemolli [Wed, 23 Jan 2013 16:23:36 +0000 (17:23 +0100)] 
Remove unused variable in client_side.cc

Detected by Coverity Scan. Issue 740595.

12 years agoBug 3676: librfcnb: Fix Shadowed variables
Amos Jeffries [Wed, 23 Jan 2013 10:38:46 +0000 (03:38 -0700)] 
Bug 3676: librfcnb: Fix Shadowed variables

12 years agoBug 3676: Fix Shadowed variables
Amos Jeffries [Tue, 22 Jan 2013 11:33:57 +0000 (00:33 +1300)] 
Bug 3676: Fix Shadowed variables

This resolves a number more shadowed variables found by the more strict
compilers in the layer-02-maximus optional components.
There should be no logic changes in this patch.

12 years agoDocument HIT ravalidation choices
Amos Jeffries [Tue, 22 Jan 2013 07:30:32 +0000 (20:30 +1300)] 
Document HIT ravalidation choices

This adds cache.log entries at level 88,3 detailing the decisions why to
convert a HIT into a MISS or REFRESH response. Resolving a users FAQ.

12 years agoBug 3676: Add compiler check for Shadowed variables
Amos Jeffries [Tue, 22 Jan 2013 06:29:59 +0000 (19:29 +1300)] 
Bug 3676: Add compiler check for Shadowed variables

12 years agoBug 3735: raw-IPv6 domain URLs crash if IPv6-disabled
Amos Jeffries [Tue, 22 Jan 2013 05:32:48 +0000 (18:32 +1300)] 
Bug 3735: raw-IPv6 domain URLs crash if IPv6-disabled

12 years agoSupport OpenSSL NO_Compression option
Sebastien Wenske [Tue, 22 Jan 2013 05:00:02 +0000 (22:00 -0700)] 
Support OpenSSL NO_Compression option

This option tells OpenSSL to disable TLS compression. A recent version
of OpenSSL library is required for this option to be available

12 years agoRelease Notes for 3.4
Amos Jeffries [Mon, 21 Jan 2013 10:57:02 +0000 (03:57 -0700)] 
Release Notes for 3.4

12 years agoBug 3676: Fix Shadowed variables
Amos Jeffries [Mon, 21 Jan 2013 08:15:06 +0000 (21:15 +1300)] 
Bug 3676: Fix Shadowed variables

This resolves some more shadowed variables by renaming. Allowing Squid to
build clean with -Wshadow. There should be no logic changes in this patch.

12 years agoRelease Notes: remove 3.3 HTML notes from 3.HEAD
Amos Jeffries [Mon, 21 Jan 2013 07:24:58 +0000 (20:24 +1300)] 
Release Notes: remove 3.3 HTML notes from 3.HEAD

12 years agoBug 3676: Fix Shadowed variables
Amos Jeffries [Mon, 21 Jan 2013 07:15:09 +0000 (20:15 +1300)] 
Bug 3676: Fix Shadowed variables

This resolves a number more shadowed variables by renaming.
There should be no logic changes in this patch.

12 years agoCompleted StoreIOState constructor, changed some flags to bool type
Francesco Chemolli [Sun, 20 Jan 2013 21:25:52 +0000 (22:25 +0100)] 
Completed StoreIOState constructor, changed some flags to bool type

12 years agoPolish: zero-initialize WCCPv2 security object
Amos Jeffries [Sun, 20 Jan 2013 04:37:30 +0000 (21:37 -0700)] 
Polish: zero-initialize WCCPv2 security object

Most of the objects fields are initialized later individually and the
rest SHOULD not matter. But it is better to be safe than sorry in this
area.

 Detected by Coverity Scan. Issue 740505.

12 years agosquidpurge: polish debug -d option handling
Amos Jeffries [Sun, 20 Jan 2013 02:01:16 +0000 (19:01 -0700)] 
squidpurge: polish debug -d option handling

Parsing of the -d option parameter was severaly broken with an inverted
NULL check resulting in segfaul whenever a level was supplied.

Also, add validation that out-of-range values cannot be supplied and
document in the help that this is a mask value, not just a number.

 Detected by Coverity Scan. Issue 740378.

12 years agoBug 3567: Memory leak handling malformed requests
Amos Jeffries [Fri, 18 Jan 2013 05:57:22 +0000 (22:57 -0700)] 
Bug 3567: Memory leak handling malformed requests

12 years agosquidpurge: Polish details of what filename is generated from
Amos Jeffries [Wed, 16 Jan 2013 11:49:51 +0000 (00:49 +1300)] 
squidpurge: Polish details of what filename is generated from

* change strlen(url) to strlen(ptrt) since the string under ptr is being
  added to filename, not the whole URL.

* also add a few extra magic bytes to make it clear that there is space
  for delimiters and termination bytes. These were previously hidden as
  extra bytes in the URL prefix length.

Should resolve Coverity Scan false positive issue 740414

12 years agosquidpurge: display friendly errors on missing command line options
Amos Jeffries [Wed, 16 Jan 2013 11:22:25 +0000 (00:22 +1300)] 
squidpurge: display friendly errors on missing command line options

Currently the tool will crash with a segmentation fault if any one of
several command switches which are expected to have a mandatory argument
are in fact followed by nothing.
 Detect these cases and display a message about what is missing.

 Detected by Coverity Scan. Issue 740378

12 years agoFix missing include in rev.12588
Amos Jeffries [Wed, 16 Jan 2013 10:35:54 +0000 (23:35 +1300)] 
Fix missing include in rev.12588

12 years agoFix ConnOpener IPv6 awareness
Amos Jeffries [Wed, 16 Jan 2013 07:30:47 +0000 (20:30 +1300)] 
Fix ConnOpener IPv6 awareness

When updating IPv6 support for split-stack one USE_IPV6 wrapper was
omitted conversion to the EnabledIpv6 stack auto-detect mechanism.
This resulted in IPv6 addresses being mis-converted on split-stack
systems or with IPv6 disabled in the kernel and --enable-ipv6 built.

The visible symptom is "assert(FALSE)" in Ip::Address::GetAddrInfo().

12 years agoSourceFormat Enforcement
Automatic source maintenance [Tue, 15 Jan 2013 01:13:22 +0000 (18:13 -0700)] 
SourceFormat Enforcement

12 years agoInitialize mem_node fully
Amos Jeffries [Tue, 15 Jan 2013 01:01:30 +0000 (18:01 -0700)] 
Initialize mem_node fully

Experience in squid-2.7 shows that with MemPools use of malloc instead
of calloc mem_node requires full initialization in order to get accurate
memory accounting.

Also closes Coverity Scan defect issue 740573.

12 years agoFix constructor order in rev.12582
Amos Jeffries [Mon, 14 Jan 2013 11:44:31 +0000 (04:44 -0700)] 
Fix constructor order in rev.12582

12 years agoPolish NULL detection in SNMP
Amos Jeffries [Mon, 14 Jan 2013 10:00:45 +0000 (03:00 -0700)] 
Polish NULL detection in SNMP

* Several places were ignoring the possibility that pointers may be NULL

  Detected by Coverity Scan. Issues 434107, 740455

12 years agoFix typo in rev.12582
Amos Jeffries [Mon, 14 Jan 2013 09:35:11 +0000 (02:35 -0700)] 
Fix typo in rev.12582

12 years agoPolish constructor initialization for StoreEntry
Amos Jeffries [Mon, 14 Jan 2013 06:55:34 +0000 (23:55 -0700)] 
Polish constructor initialization for StoreEntry

  Detected by Coverity Scan. Issues 740577, 740578

12 years agoMemPools: remove zero on allocate (calloc) from some pool types
Amos Jeffries [Mon, 14 Jan 2013 05:01:04 +0000 (22:01 -0700)] 
MemPools: remove zero on allocate (calloc) from some pool types

As we are closing defects identified by Coverity and improving
constructors everywhere we are creating a minor anti-pattern in
MemPool'ed objects with calloc() in the pool initializing the memory
then constructors re-initializing it in a better way for that object.

MemPools contains a doZeroOnPush flag to optimize performance by removing
use of memset() as chunks are added back into the pool. However, on
closer inspection it is clear that the following pop() process to re-use
those chunks is never performing memset() anyway. As such I believe that
there is no special need to use calloc() on these particular object types
in the first place.

Update MemPools to use malloc() instead of calloc() on all types with
doZeroOnPush set. This should increase performance a little, and allows
us to remove the anti-pattern by setting doZeroOnPush for more objects
as we can verify they are correctly initialized by their constructors.

12 years agoFix signed/unsigned error in rev.12573
Amos Jeffries [Sun, 13 Jan 2013 06:59:55 +0000 (19:59 +1300)] 
Fix signed/unsigned error in rev.12573

12 years agoSourceFormat Enforcement
Automatic source maintenance [Sun, 13 Jan 2013 01:13:10 +0000 (18:13 -0700)] 
SourceFormat Enforcement

12 years agoFix "address.GetPort() != 0" assertion for helpers on FreeBSD (at least).
Alex Rousskov [Sat, 12 Jan 2013 18:34:10 +0000 (11:34 -0700)] 
Fix "address.GetPort() != 0" assertion for helpers on FreeBSD (at least).

The order (or set of?) #include files used by src/ssl/helper.cc (and
probably by other helper source files) has changed recently, exposing a
defines.h dependency on sys/socket.h where that system header is
required to define AF_UNIX. With AF_UNIX incorrectly undefined,
IPC_STREAM was set to IPC_TCP_SOCKET instead of IPC_UNIX_STREAM, and
helpers that do not have a notion of a listening port, were trying to
create communication sockets using TCP streams, triggering a "must have
a port" assertion in comm_connect_addr() called from ipcCreate().

TODO: Moving IPC_* defines into an IPC-specific header file may be a
better solution then exposing all defines.h users to sys/socket.h.

12 years agoFix typo in rev.12573
Amos Jeffries [Sat, 12 Jan 2013 10:06:24 +0000 (03:06 -0700)] 
Fix typo in rev.12573

12 years agoBug 3736: Floating point exception due to divide by zero
Tianyin Xu [Sat, 12 Jan 2013 09:53:15 +0000 (02:53 -0700)] 
Bug 3736: Floating point exception due to divide by zero

12 years agoPolish debug messages on Path MTU discovery on client connections
Amos Jeffries [Fri, 11 Jan 2013 10:02:21 +0000 (03:02 -0700)] 
Polish debug messages on Path MTU discovery on client connections

* Display errors when PMTUd disable operation fails

* Correct debug message about PMTUd support being absent

 Detected by Coverity Scan. Issue 740319

12 years agoext_unix_group_acl: remove useless check for NULL
Amos Jeffries [Fri, 11 Jan 2013 06:31:01 +0000 (23:31 -0700)] 
ext_unix_group_acl: remove useless check for NULL

* the string in p is checked for NULL prior to being assigned to user
  there is no need to check it twice and doing so confuses Coverity.

 Detected by Coverity Scan. Issue 740451.

12 years agoWCCP: Fix memory leak in mask assignment, improve debuggsing.
Amos Jeffries [Fri, 11 Jan 2013 05:05:52 +0000 (22:05 -0700)] 
WCCP: Fix memory leak in mask assignment, improve debuggsing.

* Release temporary weight array allocated on each HERE_I_AM packet sent
  by Squid. For mask assignment these were not released properly and may
  build up to a significant size of memory over time.

* Add debug traces to send() events to report failures sending packets

* Also, on HERE_I_AM event send() failure, reduce the timeout to 2sec
  for the retry in a crude attempt to prevent router state flapping.

* Silence compiler warnings on use of connect() to disconnect a socket.
  Inconsistent OS behaviour makes the result useless in this case.

 Detected by Coverity Scan. Issues 740329, 740330, 740331, 740332,
    740333, 740441.

12 years agoPolish quick_abort feature decision code
Amos Jeffries [Fri, 11 Jan 2013 04:03:33 +0000 (21:03 -0700)] 
Polish quick_abort feature decision code

Also, fixes a defect identified by Coverity Scan issues 740376, 740456

12 years agoFix clang compile error in acl/Gadgets.h
Amos Jeffries [Thu, 10 Jan 2013 01:00:54 +0000 (14:00 +1300)] 
Fix clang compile error in acl/Gadgets.h

Since rev.12562 dlink_list is a class not a struct.

Detected by Squi dbuild farm FreeBSD 9.x node.

12 years agoFix memory leak in IP address unit test
Amos Jeffries [Wed, 9 Jan 2013 00:42:25 +0000 (17:42 -0700)] 
Fix memory leak in IP address unit test

Another failure to call FreeAddrInfo() after calling GetAddrInfo().

 Detected by Coverity Scan. Issue 740438.

12 years agoPrep for 3.1.23, 3.2.6, 3.3.0.3
Amos Jeffries [Wed, 9 Jan 2013 00:22:17 +0000 (17:22 -0700)] 
Prep for 3.1.23, 3.2.6, 3.3.0.3

12 years agoBug 3731: use 'int' on all systems settign TOS value.
Amos Jeffries [Tue, 8 Jan 2013 23:51:02 +0000 (16:51 -0700)] 
Bug 3731: use 'int' on all systems settign TOS value.

FreeBSD is confirmed erroring out on 8-bit variable size. Other BSD are
documented in a way that implies they do as well, although not at this
stage confirmed to be failing.
 Linux seems to be the only confirmed system workign with 8-bit size sent
to setsockopt(). So we revert this to 'int' (32-bit or 64-bit) as was
working in Squid 3.1.

12 years agoAnother piece of SQUID-2012:1
Eygene Ryabinkin [Tue, 8 Jan 2013 22:39:29 +0000 (15:39 -0700)] 
Another piece of SQUID-2012:1

12 years agosquidpurge: ensure PURGE repsonse buffer is terminated
Amos Jeffries [Sat, 5 Jan 2013 08:14:46 +0000 (01:14 -0700)] 
squidpurge: ensure PURGE repsonse buffer is terminated

 Detected by Coverity Scan. Issue 965807.

Also, additional validation check for issue 740488