robertc [Tue, 9 May 2006 05:38:33 +0000 (05:38 +0000)]
More decoupling work:
Add a URL and URLScheme class to allow separating the url parsing logic from
HTTPRequest logic which are currently bi-dependent.
Add HttpRequestMethod class to replace the enum method_t, start using it.
Split squid_curtime out from globals and tools, so you can get access to time
without dragging in other dependencies.
wessels [Tue, 9 May 2006 01:57:30 +0000 (01:57 +0000)]
bugfix: Diskd has a loop that puts Squid to sleep for small amounts of
time when the queues size reach a threshhold. The time-to-sleep is
supposed to double each time through the loop, but struct timeval delay
was initialized inside the loop, rather than outside, which meant it
always slept for 1 microsecond.
wessels [Sun, 7 May 2006 21:13:24 +0000 (21:13 +0000)]
Backed out change where clientReplyContext held a FwdState::Pointer.
That change was to fix problems with re-forwarded reqeusts where
the FwdState refcount would go to zero. But it also introduced a new
bug where errors would not be sent to clients because the refcount
did NOT go to zero.
wessels [Sat, 6 May 2006 05:33:21 +0000 (05:33 +0000)]
new feature: squid -k restart
It allows the built-in parent "watcher" process to automatically
and immediately restart Squid.
-k restart uses SIGTTIN. It is almost the same as -k shutdown
except that it sets the exit status to 1 (instead of 0). Since the
exit status is non-zero, the parent (watcher) will start squid again
immediately.
-k restart is not supported on systems that dont have SIGTTIN.
wessels [Sat, 6 May 2006 03:33:56 +0000 (03:33 +0000)]
Fix for : assertion failed: forward.cc:99: "err"
This assertion was triggered when FwdState tries to re-forward a
request. The first request fails, but can be retried. If the first
ServerState gets destroyed before the second ServerState gets
created, the FwdState refcount goes to zero. The FwdState destructor
has the above assertion because it expects an ErrorState for the
StoreEntry with no content.
This condition can easily happen because the second ServerState
isn't created until the origin server connection is established.
ie:
The clientReplyContext class now keeps a refcounted pointer to
FwdState. This was done so that FwdState refcount doesn't go to
zero during a "reforward" between the time when the initial ServerSide
gets destroyed and before the second attempt ServerSide gets created.
We don't really want to keep FwdState around until the client is
finished. As an future optimization we can remove the client side
reference around the time when the ENTRY_FWD_HDR_WAIT bit gets
cleared.
wessels [Sat, 6 May 2006 00:16:26 +0000 (00:16 +0000)]
Bugfix for assertion in httpHeaderFindEntry(). The caller,
HttpMsg::hdrCacheInit() was assuming that the content length header
is always present in the HTTP reply.
To fix I copied httpHeaderGetSize() from squid-2 code. For now
this version of httpHeaderGetSize() is basically the same as
httpHeaderGetInt(), except that it checks to see if the header
exists. If not, it returns -1.
robertc [Wed, 3 May 2006 20:04:44 +0000 (20:04 +0000)]
Add a StoreEntryStream class for use with store entries (An alternative to Packer, which uses c++ equivalents to printf. This is part of the work to decouple the squid modules to allow easier tests.
The old ClientBody code did not allow us to insert ICAP into the
flow of an HTTP request. Code in http.cc called read functions in
client_side.cc when forwarding a request body. But with ICAP in
the middle, HTTP needs to get the message body from ICAP, not
client_side.
The new BodyReader is similar to ClientBody. Now read and abort
functions are pointers, rather than hard-coded in HTTP/FTP modules.
bugfix: ICAPConfig calls aclParseAccessLine(), which now takes a
ConfigParser argument. Use the LegacyParser from cache_cf.cc, but
we need to make it global instead of static.
Cosmetic: in refreshIsCachable(), change a hard-coded number "200" to
its corresponding enum value to clarify that the 'reason' variable is
a stale/fresh reason code, rather than an HTTP status code.
Doug Dixon noticed in function handleIMSGiveClientUpdatedOldEntry()
that the call to HTTPMSGLOCK is wrapped in an if statement, but the
call to HTTPMSGUNLOCK isn't, and that the unlink_request variable
is set but otherwise unused. Probably a bug created by me in
revision 1.95, when converting to HTTPMSGUNLOCK macro.
Cosmetic: Change 'stale_flags' structure members to type bool. stale_flags
is only used locally by refresh.cc and it is somewhat silly to be
so conservative with memory.
BUGFIX: max_user_ip was broken: initialising to -1 meant that the ACL appeared
already configured to the parser, and thus it never configured to a
valid value. Fixed with a test case to ensure that a normal ACL line
will parse the -s and the limit values correctly, and a separat test
that the defaults are as expected.
Add the /usr/include/libxml2 path to CPPFLAGS if its needed to find xml/parser.h. This is only used as a fallback so it wont prevent users using a custom path in CPPFLAGS (for instance to get a /usr/local installed copy).
Shrink the all-in-one structs/prototypes/enums again, making dependencies easier to understand. Add tests for header-standalone-ness for modified or added headers.