Bug 3243: Fix cases: raw-IPv6, case variant FQDN, internal request
* do not unwrap the Host header IPv6. URL is not unwrapped for the test.
They should be identical regardless of wrapping choice.
Also ipcache happily unwraps for the intercept resolution cases
* use matchDomainName() algorithm instead of strcmp(). It is tuned for
fast case-less domain comparisons. But does support wildcard matches
so add a check of domain string length first.
* bypass for requests about to be serviced internally. We have some nasty
code of our own re-writing the URL without updating the Host: header.
Thanks to Sergey Merzlikin and Jenny Lee for detecting these.
Alex Rousskov [Tue, 30 Aug 2011 15:45:20 +0000 (09:45 -0600)]
Use a time-based limit for the Rock Store rebuild loop.
Compared to the old counter-based limit, a time-based limit is better because
it allows us to quit right after a blocked I/O or quit sooner when I/Os become
slower. Similarly, a time-based limit often allows us to rebuild a much larger
number of entries at a time because most sequential read I/Os are very fast.
Alex Rousskov [Tue, 30 Aug 2011 03:39:39 +0000 (21:39 -0600)]
Improved disker timeout handling.
A disker timeout may happen because the disker is stuck doing an I/O or
because the worker has not received an "I/O results available" notification.
If there was no notification (e.g., because the disker got stuck before
completing UDS sending steps), it is still possible that the disker output
queue cointains completed I/Os. Try to process as many of those old queued
I/Os as possible before abandoning the rest of the I/O requests.
Reduce the number of "error: timeout" lines reported at level 1. When multiple
I/Os timeout, just report the fact of the timeout, not every timedout I/O.
Needs more work to report the actual timeout value for the longest-waiting
I/O.
Double check that we are not scheduling two timeout triggers, just in case.
Alex Rousskov [Mon, 29 Aug 2011 23:14:17 +0000 (17:14 -0600)]
Use a time-based limit for the disker I/O loop.
Compared to the old counter-based limit, a time-based limit is better because
it allows us to quit right after a blocked I/O or quit sooner when I/Os become
slower.
Alex Rousskov [Mon, 29 Aug 2011 21:02:27 +0000 (15:02 -0600)]
Initial support for breaking the "do all queued I/Os" loop.
As the old TODO explained, it is necessary to break the loop to
give IpcIo notifications and other Squid process activities to
progress when many I/Os are queued or after a slow I/O blocks
the disker process for a while. More work is needed to break
based on cumulative I/O time rather than I/O count.
Alex Rousskov [Mon, 29 Aug 2011 20:58:29 +0000 (14:58 -0600)]
Made FewToFewBiQueue::peek() check both incoming and outgoing queues
to find the oldest queued value. This may help when the delay is on
our side (i.e., we are not receiving or processing completed I/Os fast enough).
Dmitry Kurochkin [Sun, 28 Aug 2011 17:11:19 +0000 (21:11 +0400)]
Disable Rock store and shared memory cache if shared memory is not available.
The patch adds support for building on systems without POSIX shared
memory (e.g. OpenBSD). IpcIo DiskIO module and Rock store is not
enabled by default if shared memory support is not available. If IpcIo
or Rock store is explicitly enabled, but no shared memory support is
available, fail with error during configure. Fail with error at
runtime if shared memory cache is enabled but no shared memory support
is detected.
Latest squid never shows DNS errors for user. When the user tries to retrieve
web page from non-existent domain, ERR_CANNOT_FORWARD error appears,
which misleads both user and administrator.
Alex Rousskov [Fri, 26 Aug 2011 20:48:08 +0000 (14:48 -0600)]
Polished unused code.
The unused dlopen() call is actually useful to enable when lt_dlopen() reports
"file not found" errors for loadable modules that do exist but that Libtool
cannot load successfully due to undefined symbols or other errors.
This inability to correctly report a library loading error is a long-standing
Libtool bug, stemming from Libtool's desire to try and load several
differently named library files until one succeeds, losing true error
information in the process.
Bertrand Jacquin [Mon, 22 Aug 2011 14:45:52 +0000 (08:45 -0600)]
Bug 2662: cf_gen failure when cross compiling
Adds support for "./configure HOSTCXX=foo" to specify a host compiler
to build cf_gen with. If none is specified the normal build compiler will
be used.
Amos Jeffries [Sat, 20 Aug 2011 15:57:06 +0000 (03:57 +1200)]
Bug 2279: Log Format options to log server source IP and port
* Add %<a and %<p log format tokens
* Remove log_ip_on_direct configuration directive
* Rename %la to %>la and %lp to %>lp
* polish log format tokens and documentation
* de-duplicate tunnel.cc and forward.cc updateHierarchyInfo() code.
This last is the only logic change. It involved creating hier.note()
and shuffling bits of code around inside forward.cc to ensure
connection setup had a single function, startConnectionOrFai(), which
began the server connect process for all destination changes.
Amos Jeffries [Fri, 19 Aug 2011 03:35:19 +0000 (21:35 -0600)]
Converts the bulk of cf_gen to C++ OOP code.
* char* tree members to std::string. Which eliminates xstrdup() and
xis*() calls.
* structs to classes and replaces calloc/free with new/delete.
* link cf_gen_depends.cci directly to autoconf.h defines.
The result of these is that we can erase the dependencies on util.h,
time.cc, config.h, libcompat.la, libmisc.la and other libraries.
Directly fixing seevral build and cross-compile issues that keep appearing
on various OS.
TODO:
There is a bit further cleanup we can do. Replacing several classes with
std::list<std::string>.
Dmitry Kurochkin [Wed, 17 Aug 2011 23:59:03 +0000 (03:59 +0400)]
Fix make check and make distcheck.
Mostly Makefile changes. Libcomm stub moved to tests/ directory
to allow using it on Makefile.am *_SOURCES instead of directly
#including it in test sources.
Pawel Worach [Sun, 14 Aug 2011 12:42:59 +0000 (00:42 +1200)]
Fix NIS helper build on FreeBSD
Fails on clang++ and other strict compilers due to missing __cplusplus
checks in FreeBSD system headers and yp_prot.h typedefs bool unless
BOOL_DEFINED is defined.
Amos Jeffries [Sat, 13 Aug 2011 15:53:38 +0000 (09:53 -0600)]
Support extended authentication states to ACL results
Support sub-states of authentication to be sent as results from ACLs.
This allows future work to resolve issues around cases such as expired
but known credentials being used in fast category access controls.
The new authentication states are:
ACCESS_AUTH_OK
- equivalent to ACCESS_ALLOWED
ACCESS_AUTH_REQUIRED
- Missing Credentials. Used to be ACCESS_REQ_PROXY_AUTH
ACCESS_AUTH_EXPIRED_OK
- Expired now. Were Okay.
ACCESS_AUTH_EXPIRED_BAD
- Expired now. Were Failed.
Also converts cases of ACCESS_REQ_PROXY_AUTH to the new name.
As yet no attempt is made to alter auth or access control logics to use
the new states.
Alex Rousskov [Sat, 13 Aug 2011 04:15:06 +0000 (22:15 -0600)]
Bug 3217: "!fd_table[fd].closing()" from ServerStateData::noteMoreBodySpaceAvailable
It is possible that the next hop connection is going through the closing steps
when we receive a "noteMoreBodySpaceAvailable" notification from the response
body consumer. Do not try to read in this case.
Mrcus Kool [Tue, 9 Aug 2011 07:09:03 +0000 (01:09 -0600)]
Optimize regular expression ACLs
This patch is inspired by the work that I did for ufdbGuard and a few emails with Amos.
The new code optimises lists of regular expressions.
The optimisations are:
* initial .* is stripped
* RE-1 RE-2 ... RE-n are joined into one large RE: (RE-1)|(RE-2)|...|(RE-n)
* -i ... -i options are optimised: the second one is ignored, same for +i
If compounding optimization fails it falls back to using unoptimized
expressions.