wessels [Sat, 5 Nov 2005 04:02:15 +0000 (04:02 +0000)]
parse_date() is one most frequent users of malloc (strdup() actually).
I think it makes sense to replace it with a static buffer and
just call xstrncpy().
wessels [Sat, 5 Nov 2005 03:23:18 +0000 (03:23 +0000)]
An optimization: If there are no request_header_access directives
configured, then don't loop through the headers for each request,
creating and destroying ACL-related objects that are never used.
hno [Thu, 3 Nov 2005 06:14:41 +0000 (06:14 +0000)]
From Squid-2:
Generalisation of the build environment to have cf_gen built more like
the other binaries. Primary reason is to allow the use of defines
inherited from squid.h or system headers in cf.data.pre conditions.
serassio [Sun, 2 Oct 2005 20:28:47 +0000 (20:28 +0000)]
Bug #1401: $HOME not set when started as root
some helpers may depend on $HOME being set to something sane, which is
not always the case when Squid is started as root. This patch sets $HOME
to the home of cache_effective_user.
Bug #1334: Can't dump core on Linux when started as root
Don't be as strict about verifying the prctl success. Not all kernels
supports this prctl, but the only downside when not supported is that
there won't be core dumps so there is no reason to report this error at
level 0.
Finish turning MemBuf into a full-fledged class. Almost all of the
former standalone functions are now methods of MemBuf class. The next
step may be to merge init() and clean() methods into the constructor
and destructor.
Made HttpMsg::parseFirstLine() a virtual method for parsing the
status and request lines of HTTP requests and responses.
Still need to write HttpRequest::parseFirstLine().
Made httpReplyHdrCacheInit() and httpRequestHdrCacheInit() into virtual
functions of HttpMsg class. Made some old static functions members of
HttpRequest and HttpReply classes so that the new hdrCacheInit() can
be private (protected).
Also fixed a memory leak with HttpHdrCc, which I may or may not have
recently created.
- Cosmetic cleanup of how // is handled within FTP URL-paths
- Clean up use of BASE HREF in ftp listings, mainly in ;type=d format
listings.
- Bug #1253: BASE HREF missing on ftp directory URLs without /
Cosmetic: Accept ftp://anonymous@ as a synonym for anonymous ftp,
not requiring a password to be entered. This is apparently used by
Symantec Live Update.
cosmetic fix: cachemgr memory stats report absurd "high (hrs)"
values for some pools because those pools are constructed before
squid_curtime is set. This patch calls time(NULL) in the
memMeterSyncHWater() macro if squid_curtime is zero.
Some changes related to URL-parsing for upcoming ICAP additions:
- findTrailingHTTPVersion() now has optional 'char *end' arg for
parsing non-terminated buffers. If end defaults to NULL, then
the string must be NULL terminated.
- urlParseMethod() now has optional 'char *end' arg.
- urlParseProtocol() now has optional 'char *end' arg.
- urlParse() now has optional 'HttpRequest *' arg. If non-NULL,
urlParse() does not allocate a new HttpRequest and returns
this passed arg.
There was a fairly significant mem_node leak because (1) nodes were
being removed from the 'nodes' list without also being deleted, and
(2) there was no storeIOWrite callback to decrement the use count.
This patch changes the mem_node use count to a boolean write_pending
flag, adds a memNodeWriteComplete() callback function, and removes
and deletes nodes at the same time. mem_hdr::unlink() was changed
to return boolean to prevent loops in freeDataUpto().
Changes to HTTP request and reply parsing classes, started by Alex,
further hacked by DW. These are forward-ported from ICAP development
on sourceforge.
Alex's original commit message:
- Moved parts common to HttpReply and HttpRequest to HttpMsg. HttpMsg is
needed to be able to pipe HTTP messages using MsgPipe without knowing
whether the message being piped is a request or response. It is also
handy for keeping ICAPXaction mostly independent from the ICAP request
method (and, hence, the primary HTTP message kind). Moving previously
duplicated code to a single location is supposed to be good long-term.
More polishing work is needed (e.g., protocol and protoPrefix need
to be merged and so can be lastmod and last_modified).
- Added reset/parse/pack methods to parse and pack HTTP messages without
knowing their direction/kind. HttpRequest::parse() is not implemented
yet but we have code that should be reusable for that.
DW's additional changes
- HttpRequest didn't really have any parsing methods or state.
Moved the HttpReply parsing methods to HttpMsg and created a
virtual function for parsing the start line (request line or
status line).
- Added full_uri flag to packInto() method because ICAP needs
full URIs in encapsulated requests.
class ClientHttpRequest had a member 'HttpVersion http_ver' which
isn't really needed. It was only used to remember the version
between calling parseHttpRequest() (where it was initially parsed)
and clientProcessRequest() (where it is permanently saved in
HttpRequest).
This patch makes a local 'http_ver' in clientProcessRequest(),
passes its pointer to parseHttpRequest() and then its value to
clientProcessRequest().
Bug #1378: Transparent proxy problem with IP Filter
On NetBSD and maybe others, when using Ipfilter 4.x, opening of the NAT device
fails.
On Solaris the following message can appear in cache.log:
parseHttpRequest: NAT lookup failed: ioctl(SIOCGNATL): (22) Invalid argument
This patch adds the usage of ipfobj structure for IP Filter 4.0alpha27 and later.
Had a coredump where ACLIP::data was NULL. This patch avoids the
NULL pointer dereference, but there might be another bug elsewhere that
allows data to be NULL.