]> git.ipfire.org Git - thirdparty/squid.git/log
thirdparty/squid.git
18 years agoAdjust refresh_pattern min-age to make 0 mean 0, not 1 second
hno [Thu, 24 May 2007 07:45:03 +0000 (07:45 +0000)] 
Adjust refresh_pattern min-age to make 0 mean 0, not 1 second

18 years agoURI-escape using the recommended upper case
hno [Thu, 24 May 2007 03:59:44 +0000 (03:59 +0000)] 
URI-escape using the recommended upper case

18 years agoKill the redundant url_convert_hex function. Equivalent to rfc1738_unescape
hno [Thu, 24 May 2007 03:10:06 +0000 (03:10 +0000)] 
Kill the redundant url_convert_hex function. Equivalent to rfc1738_unescape

18 years agoBack out unintentional commit of unrelated url.cc changes
hno [Thu, 24 May 2007 03:07:43 +0000 (03:07 +0000)] 
Back out unintentional commit of unrelated url.cc changes

18 years agoFix the cppunit tests to use setUp() rather than an static constructor to
hno [Thu, 24 May 2007 02:59:14 +0000 (02:59 +0000)] 
Fix the cppunit tests to use setUp() rather than an static constructor to
initialize memory pools etc.

Static constructors is dangerous in that you don't know for sure
in which order they will be called. The recent String pool change
where the object size is dynamically calculated on startup is and
example, where the requested pool size had not yet been calculated
before the pools was created.

18 years agoDo not reuse a persistent ICAP connection if icap_persistent_connections in
rousskov [Tue, 22 May 2007 23:43:40 +0000 (23:43 +0000)] 
Do not reuse a persistent ICAP connection if icap_persistent_connections in
squid.conf (i.e., TheICAPConfig.reuse_connections) is off. We were probably
not reusing before this change except shortly after reconfiguration and in
cases where an ICAP server does not respond with Connection: close when our
request has Connection: close.

18 years agoThe ICAP minimum for service_revival_delay and other OPTIONS retries is
rousskov [Tue, 22 May 2007 23:12:38 +0000 (23:12 +0000)] 
The ICAP minimum for service_revival_delay and other OPTIONS retries is
currntly 30 and not 60 seconds.

18 years agoBug #1966 fix: Use rounded String MemPool sizes in the hard-coded pool
rousskov [Tue, 22 May 2007 22:40:05 +0000 (22:40 +0000)] 
Bug #1966 fix: Use rounded String MemPool sizes in the hard-coded pool
config to avoid warnings that the configured pool size does not match the
actual size.

18 years agoBug #1967 fix: avoid new strncmp() that silently converts char* buffers into
rousskov [Tue, 22 May 2007 22:37:26 +0000 (22:37 +0000)] 
Bug #1967 fix: avoid new strncmp() that silently converts char* buffers into
Strings because String length is limited by 64KB and because it is an
expensive conversion.

All similar conversions should be removed, but that is bug #1970.

18 years agoRemoved hopefully unused SIZEOF_CHUNK macro in preparation for bug #1966 fix.
rousskov [Tue, 22 May 2007 09:44:34 +0000 (09:44 +0000)] 
Removed hopefully unused SIZEOF_CHUNK macro in preparation for bug #1966 fix.

18 years ago%URI external_acl_type tag for referencing the complete URI
hno [Tue, 22 May 2007 07:16:39 +0000 (07:16 +0000)] 
%URI external_acl_type tag for referencing the complete URI

18 years agoSqString.cc:198: error: cannot convert 'unsigned int*' to 'size_t*' for argument...
hno [Tue, 22 May 2007 07:15:55 +0000 (07:15 +0000)] 
SqString.cc:198: error: cannot convert 'unsigned int*' to 'size_t*' for argument '2' to 'void* memAllocString(size_t, size_t*)'

18 years agoLoad configure defines from src/cf_gen_defines
hno [Tue, 22 May 2007 05:31:37 +0000 (05:31 +0000)] 
Load configure defines from src/cf_gen_defines

18 years agoBootstrapped
hno [Mon, 21 May 2007 06:10:40 +0000 (06:10 +0000)] 
Bootstrapped

18 years agoFix 1-off bug left after strnlen bug removal.
amosjeffries [Sun, 20 May 2007 14:29:44 +0000 (14:29 +0000)] 
Fix 1-off bug left after strnlen bug removal.

Also:
 * Harden memory allocations to SqString.
 * Added more unit tests for strings.

18 years agoImplement FreeBSD ipfw based ip transparent interception using
adrian [Sun, 20 May 2007 10:22:43 +0000 (10:22 +0000)] 
Implement FreeBSD ipfw based ip transparent interception using
the getsockname() syscall. This returns the original destination
IP rather than the local server IP.

This behaviour existed in Squid-2 in the past; but was removed for some
reason.

18 years agoHaren SqStrign copy-constructor.
amosjeffries [Sun, 20 May 2007 10:22:06 +0000 (10:22 +0000)] 
Haren SqStrign copy-constructor.

18 years agoFix old bug: append sometimes does not fully copy a string if \0 exists in source
amosjeffries [Sat, 19 May 2007 20:51:14 +0000 (20:51 +0000)] 
Fix old bug: append sometimes does not fully copy a string if \0 exists in source

This bug exists in the basic implementation of strncat(dst,src,len) which will only copy EITHER to len or first \0 character, whichever comes first.
In squid this only occurs only if the string internal buffer is large enough to hold the existing plus the new strings.
The buffer re-allocation code used proper xmemcpy which does not have this limitation.
Have now set both append() branches to use the same copy mechanism.

18 years agoReally remove String.cc and String.cci
serassio [Sat, 19 May 2007 15:36:43 +0000 (15:36 +0000)] 
Really remove String.cc and String.cci

18 years agoConvert three old known points of buffer voilation to use protected code.
amosjeffries [Sat, 19 May 2007 12:49:12 +0000 (12:49 +0000)] 
Convert three old known points of buffer voilation to use protected code.

18 years agoMake string handle append(NULL) gracefully instead of core dumping.
amosjeffries [Sat, 19 May 2007 12:31:00 +0000 (12:31 +0000)] 
Make string handle append(NULL) gracefully instead of core dumping.

18 years agoFix: Squid does not compile with --enable-storeio=coss
amosjeffries [Sat, 19 May 2007 11:03:48 +0000 (11:03 +0000)] 
Fix: Squid does not compile with --enable-storeio=coss

18 years agoBootstrapped
hno [Sat, 19 May 2007 06:10:40 +0000 (06:10 +0000)] 
Bootstrapped

18 years agoFixed assertion related to TCP_RESET feature
wessels [Sat, 19 May 2007 00:30:41 +0000 (00:30 +0000)] 
Fixed assertion related to TCP_RESET feature

When 'deny_info TCP_RESET' was used (and triggered), Squid asserted
in connNoteUseOfBuffer().  Because we called comm_reset_close() in
clientReplyContext::sendMoreData(), the ClientHttpRequest was freed
before http->doCallouts() returned.  Thus we were accessing freed
memory and passing a bad value to connNoteUseOfBuffer().

I've moved the comm_reset_close() call from there to
clientProcessRequest().  I dont really like having it in
clientProcessRequest(), but it seems to be the only place that will
work.  At least this way we can avoid the destroying ClientHttpRequest
before clientProcessRequest() reaches 'finish'.

18 years agoAdded some debugging to ClientHttpRequest::doCallouts()
wessels [Sat, 19 May 2007 00:26:01 +0000 (00:26 +0000)] 
Added some debugging to ClientHttpRequest::doCallouts()

18 years agobootstrap after modifying Makefile.am please
wessels [Fri, 18 May 2007 23:20:45 +0000 (23:20 +0000)] 
bootstrap after modifying Makefile.am please

18 years agoAuthor: Tsantilos Christos <chtsanti@users.sourceforge.net>
amosjeffries [Fri, 18 May 2007 22:56:18 +0000 (22:56 +0000)] 
Author: Tsantilos Christos <chtsanti@users.sourceforge.net>
Fix compile errors slipped into ICAP on string API patch.

18 years agoSqString core apparently not automatically added to cvs by patch.
amosjeffries [Fri, 18 May 2007 12:44:35 +0000 (12:44 +0000)] 
SqString core apparently not automatically added to cvs by patch.

18 years agoAdd string API layer for better string handling.
amosjeffries [Fri, 18 May 2007 12:41:21 +0000 (12:41 +0000)] 
Add string API layer for better string handling.

For various reasons listed below we adopt the std::string API (but not the implementation) as the basis for string operations.

This patch reverts the SquidString.h file to provide only the main API and hooks for any string implementation behind the API.

For Release 3.0 the old String (now SqString) will remain the default string core.
That code has been kept in this patch with some minor modifications and bug fixes as listed below.

For Release 3.1 it is expected that a better string core will be developed.

Reasons for these changes:

The initial String implementation was incomplete and non-standard causing some risky operations at points in the code and duplicated some operations.
std::string provides a better known API for string handling which is widely use amongst other string implementations beyond std::string itself and this enables std::string or a derivative to be used in squid at some future date.
String as used previously is a defined alternative to std::string in some systems

This patch:
   - moves the old String class to SqString
   - provides the well-known type of 'string' for general use
   - provides implicit conversion from char* and char[] types
   - migrates custom functions to well-known API:
       buf()           -> c_str()
       clean()         -> clear()
   - removes redundant functions:
       buf(char*)      -> operator=(char*)
       initBuf(char*)  -> operator=(char*)
       reset(char*)    -> operator=(char*)
   - adds well-known API methods for safer string use:
       operator []
       empty()
       operator <<
       strcmp(), strcasecmp(), etc
   - May fix bug #1088 - segmentation fault after append(char*,int)
   - Fixes several unreported char* handling bugs in String/SqString

18 years agoAdd cfgman to Squid-3 snapshot generation
hno [Fri, 18 May 2007 07:26:43 +0000 (07:26 +0000)] 
Add cfgman to Squid-3 snapshot generation

18 years agoImported cf.data.pre -> HTML script from Squid-2.
hno [Fri, 18 May 2007 06:43:28 +0000 (06:43 +0000)] 
Imported cf.data.pre -> HTML script from Squid-2.

Imported changes:
2007/05/13 12:18:00 adrian +114 -0 Flesh out the beginnings of a cf.data.pre -> web interface.
2007/05/13 12:34:31 adrian +23 -2 Flesh out a little more for testing. I need to treat NAME entries with
2007/05/13 13:49:56 adrian +18 -2 Handle name aliases right.
2007/05/13 14:02:40 hno +6 -1 Add --out and --verbose command line options
2007/05/13 14:04:40 adrian +33 -32 Prepare for the actual page generating code.
2007/05/13 14:33:12 adrian +72 -19 Begin writing pages.
2007/05/13 14:43:50 adrian +8 -7 More HTML generation fixes.
2007/05/13 14:46:32 adrian +3 -2 Fix escaping.
2007/05/13 14:51:55 adrian +20 -3 Add in some more "full" template..
2007/05/13 14:58:40 adrian +15 -6 * try to show the aliases in the output; they're not yet working
2007/05/13 17:01:45 hno +133 -54 Get the ToC running, with raw section separators.
2007/05/13 21:12:56 hno +8 -0 Dump out the config manual while making snapshots
2007/05/13 21:13:14 hno +5 -3 Pick up the templates relative to the script location
2007/05/13 22:16:56 hno +108 -34 Hacked up a single page document mode
2007/05/13 22:28:49 hno +2 -0 Build single-page config manual as well as part of the snapshot process
2007/05/13 22:34:18 hno +2 -1 Compress the single-page config manual
2007/05/13 22:38:26 hno +1 -1 Correct format of single page configuration manual
2007/05/14 14:34:21 amosjeffries +102 -67 Fancy-Up the squid.conf documentation output.
2007/05/14 14:51:26 adrian +11 -2 Fix the templates to <pre>'ify suggested config.
2007/05/14 14:55:48 adrian +11 -1 Use the new format CSS now.
2007/05/14 15:16:31 adrian +16 -29 * remove the CSS stuff for now; eww.
2007/05/15 11:45:59 amosjeffries +9 -9 Fixed HTML structure somehow broken: <td> =>

18 years agoFix reply header log format %{header}<h. Was logging the request headers...
hno [Fri, 18 May 2007 01:59:41 +0000 (01:59 +0000)] 
Fix reply header log format %{header}<h. Was logging the request headers...

18 years agoAuthor: Emilio Casbas <ecasbas@unav.es>
hno [Fri, 18 May 2007 01:55:52 +0000 (01:55 +0000)] 
Author: Emilio Casbas <ecasbas@unav.es>
logformat %rp logging the URL-Path only (excluding hostname)

we need a "%ru" parameter like the httpd native log, that is showing;
/SI/images/servicios/normasdeuso/normas.swf instead of
http://X.X.X.60/SI/images/servicios/normasdeuso/normas.swf

I have done a small patch to have a new "rp" format code in order to
show only the urlpath in the access log.

18 years agoBootstrapped
hno [Mon, 14 May 2007 06:10:36 +0000 (06:10 +0000)] 
Bootstrapped

18 years agoMore magic to have the configuration manual published
hno [Mon, 14 May 2007 04:35:04 +0000 (04:35 +0000)] 
More magic to have the configuration manual published

18 years agoMove the delay pool parameters up before the MISC section (was in the middle of it..)
hno [Mon, 14 May 2007 03:27:50 +0000 (03:27 +0000)] 
Move the delay pool parameters up before the MISC section (was in the middle of it..)

18 years agoUpdate cfgman directory when making snapshots
hno [Mon, 14 May 2007 03:19:25 +0000 (03:19 +0000)] 
Update cfgman directory when making snapshots

18 years agoBootstrapped
hno [Sun, 13 May 2007 17:14:24 +0000 (17:14 +0000)] 
Bootstrapped

18 years agoBootstrapped
hno [Sun, 13 May 2007 16:57:41 +0000 (16:57 +0000)] 
Bootstrapped

18 years agoBootstrapped
hno [Sun, 13 May 2007 16:57:41 +0000 (16:57 +0000)] 
Bootstrapped

18 years agoAdd md5 sums to snapshots
hno [Sat, 12 May 2007 22:36:37 +0000 (22:36 +0000)] 
Add md5 sums to snapshots

18 years agoBug #1957 fix: Close a persistent ICAP connection if we have to open a
rousskov [Fri, 11 May 2007 19:20:57 +0000 (19:20 +0000)] 
Bug #1957 fix: Close a persistent ICAP connection if we have to open a
new connection because the transaction is not retriable.

This change avoids a growing number of open connections when many
transactions create persistent connections but only few are retriable
and can reuse them.

FwdState was already doing that. I moved FwdState logic to
PconnPool::pop so that any PconnPool user thinks about the problem and
benefits from the common solution. The change should have no material
affect on FwdState.

18 years agoFixed "if (srv->flags.reserved = S_HELPER_FREE)" typo, assuming it should have
rousskov [Fri, 11 May 2007 10:06:08 +0000 (10:06 +0000)] 
Fixed "if (srv->flags.reserved = S_HELPER_FREE)" typo, assuming it should have
been "==" and not "!=".

18 years agoReplaced one more mem-> with direct mem_obj-> reference.
hno [Fri, 11 May 2007 04:40:12 +0000 (04:40 +0000)] 
Replaced one more mem-> with direct mem_obj-> reference.

18 years agoBootstrapped
hno [Thu, 10 May 2007 06:10:38 +0000 (06:10 +0000)] 
Bootstrapped

18 years agoPreparing to release Squid-3.0.PRE6 SQUID_3_0_PRE6
wessels [Thu, 10 May 2007 04:14:24 +0000 (04:14 +0000)] 
Preparing to release Squid-3.0.PRE6

18 years agoICAPModXact needs to use the new AUTHUSERREQUESTLOCK() macro
wessels [Wed, 9 May 2007 21:52:35 +0000 (21:52 +0000)] 
ICAPModXact needs to use the new AUTHUSERREQUESTLOCK() macro

18 years agoFixed NULL pointer passed to xstrdup in AuthUser::username().
wessels [Wed, 9 May 2007 21:26:12 +0000 (21:26 +0000)] 
Fixed NULL pointer passed to xstrdup in AuthUser::username().

18 years agoBug #1951: NTLM authentication does not work
wessels [Wed, 9 May 2007 15:07:38 +0000 (15:07 +0000)] 
Bug #1951: NTLM authentication does not work

Turns out there were a number of reasons why NTLM authentication
didn't work.  Some of these were addressed by patches committed a
few revs earlier.  With this current patch, Squid is now handling
a Web Polygraph workload with NTLM authentication.

The big change here is to locking of AuthUserRequest by the various
other classes that maintain a pointer to it.  The old locking logic
was difficult for me to follow, and it seemed that there were not
enough unlocks, leading to helper processes getting stuck in RESERVED
state.

I copied the ideas from HttpMsg locking and created macros
AUTHUSERREQUESTLOCK and AUTHUSERREQUESTUNLOCK.  I also tried to
make sure that locks and unlocks occur in places where pointers are
assigned.  The most tricky part is with the ACLchecklist class,
which passes a pointer to a pointer.  Previously AuthUserRequest
was doing a lot of locking on behalf of ACLchecklist, but now I
make ACLchecklist do all its own locking and AuthUserRequest really
shouldn't lock its own objects for any other classes.

Another important change was to helperStatefulReleaseServer().  The
old version apparently ignored helper servers in the S_HELPER_RESERVED
states.  It was only concerned about the S_HELPER_DEFERRED state.
Now I think it does the right thing for both states.

This patch also contains numerous cosmetic "style" changes to the
source code and debugging that don't really affect its functionality.
I couldn't resist.

18 years agoAuthor: Henrik Nordstrom <hno@squid-cache.org>
wessels [Wed, 9 May 2007 14:31:47 +0000 (14:31 +0000)] 
Author: Henrik Nordstrom <hno@squid-cache.org>
Fixed assertion at src/ACLChecklist.cc:200

assertion failed: /home/henrik/SRC/squid/commit-3/src/ACLChecklist.cc:200:
"!finished() && !asyncInProgress()"

This is due to the checklist being marked as done twice, first in
ProxyAuthNeeded::checkForAsync during the match, and then in
ACLChecklist::matchAclList before returning the verdict.

18 years agoFixed free() errors in AuthUser::~AuthUser()
wessels [Wed, 9 May 2007 14:26:57 +0000 (14:26 +0000)] 
Fixed free() errors in AuthUser::~AuthUser()

AuthUser::~AuthUser() was freeing memory in the middle of an allocated
buffer.  I think AuthUser needs a strdup'd copy of the username,
rather than keeping a pointer to the buffer read from the helper.

Also I found 'xfree((char *)username());' really odd.  This username()
method does not return a reference so it shouldn't be used as LHS
in the macro.

18 years agoFixed NULL pointer bug in new version of auth_ntlm.cc.
wessels [Wed, 9 May 2007 14:14:09 +0000 (14:14 +0000)] 
Fixed NULL pointer bug in new version of auth_ntlm.cc.

Don't create a local 'ntlm_user' variable and set it to NULL.

18 years agoPort of 2.6/changesets/11280.patch
wessels [Wed, 9 May 2007 14:07:23 +0000 (14:07 +0000)] 
Port of 2.6/changesets/11280.patch

This is a port of
http://www.squid-cache.org/Versions/v2/2.6/changesets/11280.patch
to Squid-3.  It seems that this particular patch was skipped
or missed when other squid-2 changes were ported to squid-3.

This patch removes the AUTHENTICATE_STATE_FINISHED state from
authentication code.  It also moves some medium sized blocks of
code from the ::authenticate() method to the to
authenticateFooHandleReply() function.

18 years agoRemoved auth_user_request_t typedef. Just use AuthUserRequest.
wessels [Wed, 9 May 2007 13:45:58 +0000 (13:45 +0000)] 
Removed auth_user_request_t typedef.  Just use AuthUserRequest.

Actually removed it from src/typedefs.h this time.

18 years agoRemoved auth_user_request_t typedef. Just use AuthUserRequest.
wessels [Wed, 9 May 2007 13:36:24 +0000 (13:36 +0000)] 
Removed auth_user_request_t typedef.  Just use AuthUserRequest.

18 years agoAuthor: Guido Serassio <guido.serassio@acmeconsulting.it>
rousskov [Tue, 8 May 2007 23:26:54 +0000 (23:26 +0000)] 
Author: Guido Serassio <guido.serassio@acmeconsulting.it>
Removed unused ICAPClientStream code.

The functions provided by ICAP/ICAPClientStream.{cc,h} were called from
client_side_reply.cc but the code was #ifdef-ed with
ICAP_CLIENT_RESPMOD_POSTCACHE, which was not defined anywhere. Somebody was
either trying to get ICAP RESPMOD post-cache work with client streams long
time ago (but did not get far) or just wanted to provide hooks for future use.

18 years agoBootstrapped.
rousskov [Tue, 8 May 2007 22:52:59 +0000 (22:52 +0000)] 
Bootstrapped.

18 years ago Bug #1819 fix: retry the ICAP transaction when its pconn fails.
rousskov [Tue, 8 May 2007 22:46:37 +0000 (22:46 +0000)] 
Bug #1819 fix: retry the ICAP transaction when its pconn fails.

The changes in these files (all ICAP initiators) were minor,
except the client side no longer bypasses failed queries for
essential ICAP services because ICAPLauncher tells its initiator
whether the failure is bypassable.

Search src/ICAP/ICAPXaction.cc log around v1.7 for complete
details of the bug #1819 fix.

18 years ago Two unrelated changes: A failed ICAP RESPMOD transaction could leave
rousskov [Tue, 8 May 2007 22:45:00 +0000 (22:45 +0000)] 
Two unrelated changes: A failed ICAP RESPMOD transaction could leave
the HTTP transaction stuck and a bug #1819 fix.

Change 1: After detecting an ICAP error and calling fwd->fail(),
the HTTP Server now calls abortTransaction() (and, hence,
comm_close) instead of calling closeServer() (and, hence,
fwd->unregister).  Server::closeServer() is a virtual method
that should not be called outside of Server::serverComplete().
It would be nice to enforce that somehow. Perhaps we should at
least rename closeServer?

Change 2: Bug #1819 fix: retry the ICAP transaction when its
pconn fails. The changes in this file were minor. Search
src/ICAP/ICAPXaction.cc log around v1.7 for complete details of
the bug #1819 fix.

18 years ago Make sure the entire response body gets to ICAP, even when the
rousskov [Tue, 8 May 2007 22:37:59 +0000 (22:37 +0000)] 
Make sure the entire response body gets to ICAP, even when the
end of it does not fit into the BodyPipe buffer.

Re-enabled code that limits the amount of data the server may
read depending on the available ICAP BodyPipe buffer size.
While new BodyPipes limit the amount of data they accept, we
still need the external limit because there is no code to keep
pumping data into the pipe once the HTTP response ends and
serverComplete() is called. If any body data is left in the
HTTP server read buffer at the serverComplete() time, that data
is lost and the client gets a truncated response.

It is not clear whether it is better to stall the faster HTTP
server I/O to let the slower ICAP server consume the body from
the pipe OR to add code that will drain leftovers from the HTTP
read buffer into the pipe.

18 years ago Bug #1819 fix in three parts: Retry failed ICAP pconns.
rousskov [Tue, 8 May 2007 22:32:11 +0000 (22:32 +0000)] 
    Bug #1819 fix in three parts: Retry failed ICAP pconns.

Bug #1819 fix, part 1: simplify ICAPInitiator-ICAPXaction link.
Part 1 changes should have no effect on Squid functionality.

To retry failing persistent ICAP connections we may need to
start more than one ICAP transaction for a given HTTP message.
This needs to be done somewhere between ICAPInitiator and
ICAPXaction so that neither is affected much. The design will
be similar to HTTP FwdState.

This change reduces ICAPInitiator dependency on ICAPXaction so
that it is easier to insert transaction retrying logic/code
between them. It should have no effect on Squid functionality.

HTTP client and server (both ICAPInitiators) used to keep a
Pointer to ICAP transaction and extracted adapted headers from
the finished transaction using that Pointer (which forced
ICAPModXact to use a self-Pointer).  ICAP service
representative used custom callbacks to receive new options
from ICAPOptXact.

Now, all ICAP initiators use the same asynchronous
message-based API to communicate with ICAP transactions they
initiate. On the core side, the API is defined by
ICAPInitiator, as before. On the ICAP side, the API is defined
by the newly added ICAPInitiate class. The latter will also be
used as a base for ICAPLauncher, the future ICAP transaction
retrying class.

Bug #1819 fix, part 2: retry the ICAP transaction when its
pconn fails. Part 2 changes should enable Squid to handle race
conditions of ICAP pconns.

HTTP client, server, and ICAP server representative (all
ICAPInitiators) used to start ICAP transactions. If a
transaction fails due to a persistent connection race
condition, the initiator would either terminate the HTTP
transaction or bypass the ICAP failure, violating the protocol.

Now, instead of starting an ICAP transaction directly, the
above initiators start ICAP Launcher. The Launcher starts the
ICAP transaction and retries it (i.e., starts another
transaction with the same set of parameters) if needed. The
Launcher is both ICAP initiator (because it starts ICAP
transactions) and ICAP initiate (because it is started by other
ICAP initiators). The launcher proxies ICAP communication
(usually one or two messages each way) and makes retries
transparent to initiators.

All ICAP transactions corresponding to the same adaptation of
an HTTP message are sometimes referred to as a single ICAP
query.

An ICAP transaction can be retried until it read data from the
ICAP server or consumed virgin body. This means that a ICAP
transaction may go as far as writing the entire ICAP Preview
before aborting in a retriable state. When retrying, persistent
connections are not used. If the first retry fails, the query
fails. Thus, a query cannot contain more than two transactions.

Two new things were added to support ICAPLauncher:

First, AsyncJob, is a class that handles the basic logic of
maintaining an asynchronous job or task such as an ICAP
transaction or a launcher. All core AsyncJob functionality was
moved from ICAPXaction and ICAPModXact classes. We could not
use the two classes for the launcher because ICAPLauncher is
not a transaction.  While currently specific to ICAP, this
object may eventually be moved to Squid core and serve as a
base for other asynchronous jobs or logical threads.

Second, a temporary hack was added to support cbdata operations
by two parents of a single CBDATA class (ICAPLauncher is both
ICAP Initiator and Initiate). The second parent (ICAPInitiator)
defines toCbdata() method that ICAPLauncher overwrites to
provide a usable cbdata pointer to code that only sees an
ICAPInitiator pointer. The ICAPInitiator pointer is unusable
for cbdata when it comes from the middle of the ICAPLauncher
object. Also, the initiator pointer is stored along with its
cbdata so that the latter can be accessed (and unlocked) even
if the initiator object is already deleted. These hacks will
disappear once cbdata becomes object-aware.

Bug #1819 fix, part 3: do not reuse a pconn when we may fail to
retry it. Part 3 changes ensure that the HTTP message body is
backed up when reusing a persistent connection (until we know
there are no race conditions). They also disable pconns when we
cannot backup enough.

Decide on preview before connecting to the ICAP server because
if we are doing preview, we can retry a failed pconn even if we
cannot backup the entire body. Renamed shouldPreview() to
decideOnPreview() and made the call less dependent on the
context.

Disable transaction retries if we are not using a persistent
connection. ICAP does not talk about retrying failures other
than pconn race conditions.

It might be OK to retry other failures, but I have not done the
required analysis and am not going to do that in the
foreseeable future. For example, other failures may need other
conditions for disabling retries (current code should disable
retries when the first response byte is read).

18 years agoIf a consumer leaves without consuming anything, do not tell
rousskov [Tue, 8 May 2007 22:16:42 +0000 (22:16 +0000)] 
If a consumer leaves without consuming anything, do not tell
the producer that the consumer has aborted.

This change increases the risk that, due to bugs, no [other]
consumer will come and the producer will get stuck waiting for
the buffer space. However, this risk should be mitigated by
timeouts because no amount of code can ensure eventual consumer
presence if producer and consumer are asynchronous.

This change was needed to support ICAP transaction retries.
When a transaction aborts due to pconn race conditions, without
consuming body buffer, the second transaction will start from
scratch and become the body consumer.

18 years agoAdded cbdataProtected parameter to control the last eventAdd
rousskov [Tue, 8 May 2007 22:15:50 +0000 (22:15 +0000)] 
Added cbdataProtected parameter to control the last eventAdd
parameter. Defaults to true, just like with eventAdd.

18 years agoUpdated NTLM/Negotiate test clients, explaining a bit of their use.
hno [Tue, 8 May 2007 05:37:47 +0000 (05:37 +0000)] 
Updated NTLM/Negotiate test clients, explaining a bit of their use.

Added a trivial Basic auth test helper.

18 years agoAdded HTTP status code 307 (Temporary Redirect) to cacheableReply()
wessels [Tue, 8 May 2007 04:25:15 +0000 (04:25 +0000)] 
Added HTTP status code 307 (Temporary Redirect) to cacheableReply()

18 years agoAuthor: Alex Rousskov <rousskov@measurement-factory.com>
wessels [Tue, 8 May 2007 03:51:21 +0000 (03:51 +0000)] 
Author: Alex Rousskov <rousskov@measurement-factory.com>
Bug #1752: cbdata problems with storeRegisterAbort()

Bug found by valgrind.  There is no cbdata reference held by
storeRegisterAbort() and abort.data should be a cbdata reference
pointer.

18 years agoFtpState should not call StoreEntry::unregisterAbort()
wessels [Tue, 8 May 2007 03:32:00 +0000 (03:32 +0000)] 
FtpState should not call StoreEntry::unregisterAbort()

Since FtpState does not register an abort handler, it should not
call unregisterAbort().

18 years agoAuthor: Alex Rousskov <rousskov@measurement-factory.com>
wessels [Tue, 8 May 2007 01:54:58 +0000 (01:54 +0000)] 
Author: Alex Rousskov <rousskov@measurement-factory.com>
Bug #1950: cachemgr requests for auth helper stats can crash Squid

Also need to update unit tests after changing  the
helperStats() and helperStatefulStats() interfaces.

18 years agoAuthor: Alex Rousskov <rousskov@measurement-factory.com
wessels [Tue, 8 May 2007 00:38:40 +0000 (00:38 +0000)] 
Author: Alex Rousskov <rousskov@measurement-factory.com
Bug #1950: cachemgr requests for auth helper stats can crash Squid

Partially-configured authentication helpers may result in Squid
crashes when requesting stats via cachemgr.  The attached patch
moves the "is this helper valid?" check into the helper*Stats()
function so that new helpers do not introduce more bugs like this
one.

This patch also reports invalid/nonexistent helpers, which may or
may not be the right thing to do (but would be trivial to change
since the reporting code is in one place now).

18 years agoAuthor: Alex Rousskov <rousskov@measurement-factory.com>
wessels [Tue, 8 May 2007 00:12:28 +0000 (00:12 +0000)] 
Author: Alex Rousskov <rousskov@measurement-factory.com>
Bug #1688: assertion when Squid filters HTTP headers

HttpHeader::delAt does not update the header mask. This patch adds a parameter
to delAt, which forces the caller to pay attention and call newly added
HttpHeader::refreshMask after calling HttpHeader::delAt.

The patch also optimizes Keep-Alive header handling and comments on
HDR_PROXY_CONNECTION handling.

18 years agoAdd HTTP status codes 416 and 417 to the list that Squid knows about.
wessels [Sat, 5 May 2007 06:16:32 +0000 (06:16 +0000)] 
Add HTTP status codes 416 and 417 to the list that Squid knows about.

Adding these new status codes to HttpStateData::cacheableReply()

18 years agoFTP will no longer send REST command if offset exceeds size.
wessels [Sat, 5 May 2007 06:14:17 +0000 (06:14 +0000)] 
FTP will no longer send REST command if offset exceeds size.

Added a check to FtpState::restartable to detect when the desired
restart offset is greater than (or equal to) the size reported by
the server.  If the server didn't report a size, then we won't
send/set the restart offset either.

18 years agoFixed "spec->length >= 0" assertion for FTP request with range
wessels [Sat, 5 May 2007 05:46:42 +0000 (05:46 +0000)] 
Fixed "spec->length >= 0" assertion for FTP request with range

An FTP request with range offset larger than the content length
would result in a negative spec->length.  With this patch
we detect the condition and return a 200, instead of 206, reply.

The reply may be bogus, depending on how the FTP server behaves.
For example, the reply may have non-zero content-length header,
but no actual content (because we told the FTP server to restart
beyond the content size).

A future patch will try to make sure that we don't send a restart
command beyond the known object size.

18 years agoAdd HTTP status codes 416 and 417 to the list that Squid knows about.
wessels [Sat, 5 May 2007 04:12:55 +0000 (04:12 +0000)] 
Add HTTP status codes 416 and 417 to the list that Squid knows about.

18 years agoRemoved repeated assertion from httpHdrRangeRespSpecPackInto
wessels [Sat, 5 May 2007 02:30:16 +0000 (02:30 +0000)] 
Removed repeated assertion from httpHdrRangeRespSpecPackInto

18 years agoAvoid memory leaks when submitting a NULL helper.
rousskov [Fri, 4 May 2007 21:40:12 +0000 (21:40 +0000)] 
Avoid memory leaks when submitting a NULL helper.

18 years agoRemoved casts from numeric types in debugs() statements.
wessels [Mon, 30 Apr 2007 22:56:09 +0000 (22:56 +0000)] 
Removed casts from numeric types in debugs() statements.

After converting debug to debugs, there were quite a few instances
of casts left over.  I removed casts for int, unsigned, long, and
one double.

18 years agoFixed buffer overflow bug in whois.cc.
wessels [Mon, 30 Apr 2007 22:38:19 +0000 (22:38 +0000)] 
Fixed buffer overflow bug in whois.cc.

Terminating null was written one byte past end of the buffer,
clobbering the dataWritten variable.  Caused an assertion for whois
replies longer than BUFSIZ (1024) bytes.

18 years agoCompile error: the address of `void sigusr2_handle(int)', will always evaluate as...
hno [Sun, 29 Apr 2007 23:45:18 +0000 (23:45 +0000)] 
Compile error: the address of `void sigusr2_handle(int)', will always evaluate as `true'

Not sure what the error really is about, but we don't need to print out
that address, the function name is better..

18 years agoThe hex/dec I/O format operators is in the std namespace
hno [Sun, 29 Apr 2007 23:35:52 +0000 (23:35 +0000)] 
The hex/dec I/O format operators is in the std namespace

18 years agoAuthor: Tsantilas Christos <chtsanti@users.sourceforge.net>
hno [Sun, 29 Apr 2007 04:26:37 +0000 (04:26 +0000)] 
Author: Tsantilas Christos <chtsanti@users.sourceforge.net>

Convert debug statements to debugs

18 years agoAdding a comment that tests/testUfs will fail when 'heap' is the only
wessels [Thu, 26 Apr 2007 22:01:31 +0000 (22:01 +0000)] 
Adding a comment that tests/testUfs will fail when 'heap' is the only
configured replacement policy.

18 years agoChange diskd default DebugLevel to 0
wessels [Wed, 25 Apr 2007 22:41:56 +0000 (22:41 +0000)] 
Change diskd default DebugLevel to 0

At DebugLevel = 1, diskd prints "errors" to cache.log when operations
such as open, read, and unlink fail.  These "errors" are not fatal.
In fact, some are to be expected due to the asynchronous nature of
diskd.  The upper layers of Squid are designed to handle these
"errors" gracefully.  They should not be in the log by default
because naive users may report them as bugs.

18 years agoBug #1940: assertion failed: store.cc:850
rousskov [Wed, 25 Apr 2007 20:37:55 +0000 (20:37 +0000)] 
Bug #1940: assertion failed: store.cc:850
Avoid calling writeReplyBody when there is no reply body data to write.

FtpStateData calls processReplyBody from several places. When called from
icapAclCheckDone we may not be expecting a body for this response. If no body
is expected, the store entry may not be in a STORE_PENDING state and when we
try to append [zero-sized] body data, the store asserts.

If no body is expected, we probably should not be calling processReplyBody!
Unfortunately, it was not obvious for me what we should call so I left the
call there and made it bypass store writing if there is no body content.

If you understand the FtpStateData logic, please try to make sure
processReplyBody is not called for objects without a body (it is possible that
something else should be called instead though). Please note that ICAP sets
virginBodyDestination when body is expected.

18 years agoAmos Jeffries' tidyup of the debugging sections.
adrian [Wed, 25 Apr 2007 17:30:14 +0000 (17:30 +0000)] 
Amos Jeffries' tidyup of the debugging sections.

18 years agoBootstrapped
hno [Wed, 25 Apr 2007 06:10:43 +0000 (06:10 +0000)] 
Bootstrapped

18 years agounit testing fix for tests/testCoss.cc
wessels [Wed, 25 Apr 2007 05:35:46 +0000 (05:35 +0000)] 
unit testing fix for tests/testCoss.cc

note that store_dirs_rebuilding is now initialized to 1 instead of 0

18 years agoFix tests/testCoss; storeSwapOut is now StoreEntry::swapOut
wessels [Wed, 25 Apr 2007 05:16:35 +0000 (05:16 +0000)] 
Fix tests/testCoss; storeSwapOut is now StoreEntry::swapOut

18 years agoFix 'unknown http status code in reply' for status 408 replies
wessels [Wed, 25 Apr 2007 05:13:25 +0000 (05:13 +0000)] 
Fix 'unknown http status code in reply' for status 408 replies

HttpStateData::cacheableReply complains about HTTP status codes
that aren't in the switch list.  I've added 408 (HTTP_REQUEST_TIMEOUT)
and others that were missing.

18 years agobootstrapped after henrik modified src/Makefile.am
wessels [Tue, 24 Apr 2007 22:23:40 +0000 (22:23 +0000)] 
bootstrapped after henrik modified src/Makefile.am

18 years agoSQUID_HELPER define for including squid.h from helpers
hno [Tue, 24 Apr 2007 21:04:22 +0000 (21:04 +0000)] 
SQUID_HELPER define for including squid.h from helpers

squid.h has some debugging stuff in it which should only apply to the main
squid binary, not various helpers also referencing squid.h.

This patch also splits the unlinkd helper from unlinkd.cc to unlinkd_daemon.cc
to make it more readable.

18 years agoReserver the oa and ot logformat tags for outgoing address/tos.
hno [Tue, 24 Apr 2007 21:01:55 +0000 (21:01 +0000)] 
Reserver the oa and ot logformat tags for outgoing address/tos.

18 years agobootstrapped after modifying lib/Makefile.am
wessels [Tue, 24 Apr 2007 12:35:52 +0000 (12:35 +0000)] 
bootstrapped after modifying lib/Makefile.am

Adding xusleep to libmiscutil

18 years agoFix for compiling src/unlinkd.cc with kqueue and epoll.
wessels [Tue, 24 Apr 2007 12:30:36 +0000 (12:30 +0000)] 
Fix for compiling src/unlinkd.cc with kqueue and epoll.

When Squid is compiled with --enable-kqueue or --enable-epoll, we're
not supposed to use any fd_set structures.  unlinkd.cc uses select()
to pause and wait for for feedback from the external unlinkd helper.
But when using kqueue or epoll, unlinkd.cc will have to use "usleep"
emulation rather than select.

The contents of lib/xusleep.c and include/xusleep.h have been copied
from Squid-2 sources.

18 years agoBootstrapped after fixing 'make check' for --disable-unlinkd
wessels [Tue, 24 Apr 2007 06:42:34 +0000 (06:42 +0000)] 
Bootstrapped after fixing 'make check' for --disable-unlinkd

18 years agoBootstrapped after fixing 'make check' for --disable-unlinkd
wessels [Tue, 24 Apr 2007 06:42:17 +0000 (06:42 +0000)] 
Bootstrapped after fixing 'make check' for --disable-unlinkd

Long summary

18 years agoFix 'make check' for --disable-unlinkd
wessels [Tue, 24 Apr 2007 06:40:25 +0000 (06:40 +0000)] 
Fix 'make check' for --disable-unlinkd

'make check' fails with --disable-unlinkd because the Makefiles refer
to unlinkd.cc, which should not be compiled when it is disabled.  Fixed
by changing references of unlinkd.cc to the $(UNLINKDSOURCE) macro.

18 years agoFixed "ftpReadTransferDone: Got code 426 after reading data" SEGV
wessels [Mon, 23 Apr 2007 23:50:49 +0000 (23:50 +0000)] 
Fixed "ftpReadTransferDone: Got code 426 after reading data" SEGV

Whenever ftpReadTransferDone got an unexpected status code, it would
also SEGV.  It happened because the FtpStateData object was destroyed
in the middle of the dataRead method, just before the final call to
processReplyBody.

A workaround seems to be to call scheduleReadControlReply with
buffered_ok=0 so that the object isn't destroyed within the
same call sequence.

I was tempted to put a return after the dataComplete call in
ftpReadTransferDone so that we won't call processReplyBody
when len == 0, but I'm concerned that may break things when ICAP
is in use.

18 years agoFix "store_status == STORE_PENDING" assertion in FTP with large responses
wessels [Mon, 23 Apr 2007 13:29:57 +0000 (13:29 +0000)] 
Fix "store_status == STORE_PENDING" assertion in FTP with large responses

An FTP object that exceeds reply_body_max_size leads to an assertion
failure.  The StoreEntry is aborted by the call to appendSuccessHeader(),
but the abort callback is delayed due to using events.  We need to
check for ENTRY_ABORTED (again) right after the appendSuccessHeader()
call -- yuck.

18 years agoAuthor: Tsantilas Christos <chtsanti@users.sourceforge.net>
wessels [Mon, 23 Apr 2007 12:11:55 +0000 (12:11 +0000)] 
Author: Tsantilas Christos <chtsanti@users.sourceforge.net>
Fix compile-time issue related to removing getRaw() uses.

Tsantilas says Squid won't compile with delay pools enabled after
I removed getRaw() here.  It seems to compile okay on FreeBSD (gcc
3.4.2), but it is certainly better to write "if (X == NULL)" rather
than "if (!X != NULL)".