wessels [Sat, 21 Feb 1998 04:04:50 +0000 (04:04 +0000)]
little rewriting needed for disk write callbacks. The callback
may close the FD, so it must be the last thing we do in
that function. Fixed cbdata leak.
wessels [Sat, 21 Feb 1998 01:47:06 +0000 (01:47 +0000)]
- Unescape URL-path in urlParse() so jokers can't bypass ACLs. Complain
if the resulting URL still has a % character in it.
- Other cleanup; removed some #ifdef'd code
wessels [Wed, 18 Feb 1998 08:00:43 +0000 (08:00 +0000)]
From: Henrik Nordstrom <hno@hem.passagen.se>
Squid-1.2.beta15: Show memory map as a tree
Part of my beta14 memory map patch did not make it into beta15.
Here are the missing pieces.
wessels [Wed, 18 Feb 1998 07:38:53 +0000 (07:38 +0000)]
From: Henrik Nordstrom <hno@hem.passagen.se>
Here is a patch that adds support for PORT and default mode FTP data
channel.
1. Try PASV
2. If that fails, try PORT
3. If all fails, fall back on using the default data channel (same local
port as used by the control connection).
Now I think the FTP gateway in Squid is fylly compliant with RFC 1738
(URL) and STD 9 (FTP) for fetching files and directory listings.
FTP PUT support remains to be done. As I said earlier the hard part here
is in client_side.c: to get request bodies down to the protocols in a
clean manner.
wessels [Wed, 18 Feb 1998 06:28:22 +0000 (06:28 +0000)]
From Henrik
This patch adds a automatic adjustment of RESERVED_FD when we fail to
create sockets. This functionality mentioned in the comments in
comm_open, but there was no code implementing it...
wessels [Wed, 18 Feb 1998 02:08:34 +0000 (02:08 +0000)]
From: "Michael O'Reilly" <michael@metal.iinet.net.au>
Required, becuase the contents of errno are undefined unless the
previous library call returned an error. Errno is NOT cleared on a
successful library call.
wessels [Wed, 18 Feb 1998 01:15:22 +0000 (01:15 +0000)]
Fixed NULL pointer bug from a storeClientCopy callback. We sort of
overloaded "size < 0" for these callbacks. Sometimes its a store-side
failure (didn't open swap file), and sometimes its a client-side
cancellation. If its cancelled from the client side we check that
http->entry != NULL before proceeding with the request.
wessels [Sat, 14 Feb 1998 01:26:52 +0000 (01:26 +0000)]
From Henrik Nordstrom
- A built in memory leak detector. Activated when compiled with
--enable-xmalloc-debug-trace. Squid-1.2.beta14: Option -m to turn on
malloc tracing
- The printing of the memory tracing is turned on by using the -m option
when starting squid, or by setting the global variable xmalloc_trace to
true from a debugger. A useful GDB macro:
define malloc_info
printf "Allocation %d from %s:%d size %d\n", \
malloc_number($arg0), malloc_file_name($arg0), \
malloc_line_number($arg0), mallocblksize($arg0)
end
wessels [Sat, 14 Feb 1998 00:47:38 +0000 (00:47 +0000)]
From: Henrik Nordstrom <hno@hem.passagen.se>
This patch changes the content-type for type specified ftp transfers to
type=i -> application/octet-stream
type=a -> text/plain
wessels [Fri, 13 Feb 1998 06:35:58 +0000 (06:35 +0000)]
- Added -S command line option to double-check store
consistency with disk files in storeCleanup().
- Fixed a problem with transactional logging. In many
cases we were adding the public cache key and then
logging a delete for the private key. This is worthless
because during rebuild we could not locate the previous
public-keyed entry. Now we assert that only public-keyed
entries can be logged to swap.state. storeSetPublicKey()
and storeSetPrivateKey() have been modified to log an
ADD or DEL when the key changes.
- Fixed storeDirClean bug. Needed to call
storeDirProperFileno() so the "dirn bits" get set.
- Fixed a storeRebuildFromDirectory bug. fullpath[] and
fullfilename[] were static to that function and did
not change when the "rebuild_dir" arg did. Moved these
buffers to the rebuild_dir structure.
- In storeRebuildFromSwapLog, we were calling storeRelease()
for cache key collisions. This only set the RELEASE_REQUEST
bit and did not clear the swap_file_number in the filemap or
in the StoreEntry, so the swap file could get unlinked later
when it was really released.
wessels [Thu, 12 Feb 1998 14:03:04 +0000 (14:03 +0000)]
- Changed StoreEntry->object_len to ->swap_file_sz so we
can verify the disk file size at restart. Moved object_len
to MemObject->object_sz. Note object_sz is initialized
to -1. If object_sz < 0, then we need to open the swap
file and read the swap metadata.
- Changed store_client->mem to ->entry because we need
e->swap_file_sz to set mem->object_sz at swapin.
- Removed some superfluous checks for e->key != NULL in
storeSet*Key().
- Renamed storeSwapData structure to storeSwapLogData.
- Fixed storeGetNextFile to not increment d->dirn. Added
check for opendir() failure.
- Fixed storeRebuildStart to properly link the directory
list for storeRebuildfromDirectory mode.
wessels [Wed, 11 Feb 1998 01:39:36 +0000 (01:39 +0000)]
Changed error message generated when we read 0 bytes from the FTP
server control socket. Instead of a read error, call it an FTP
protocol error. Thats not really great either. maybe we need a new
ERR_ type.
wessels [Tue, 10 Feb 1998 07:55:03 +0000 (07:55 +0000)]
Changes to accomodate disk write failures:
0) The problem: file_close() doesn't always close the file immediately;
i.e. when there are pending buffers to write. However, after
calling file_close, we were also calling storeUnlockObject and
the lock count could become zero then. Bad things would happen
if we got a callback from a file_write after the lock count went
to zero. We need a way to prevent the file_write callback from
happening when we "close" the swapout FD.
1) the file_write() callback data must now be in the callback
database (cbdata). We can't add StoreEntry's to cbdata for a couple
of reasons. So now we use the swapout_ctrl_t structure for the
callback data. Previously this was used only for the file_open
process, but now we keep it around for the entire swapout duration.
A new element MemObject->swapout.ctrl points to this data strucutre
so we can re-access it from storeCheckSwapOut.
2) Changed the way write errors are handled by diskHandleWrite.
If there is no callback function, now we exit with a fatal
message under the assumption that the file in question is a log
file or IPC pipe. Otherwise, we flush all the pending write
buffers (so we don't see multiple repeated write errors from
the same descriptor) and let the upper layer decide how to handle
the failure.
3) Fixes to storeDirWriteCleanLogs. A write failure was leaving some
empty swap.state files, even though it tells us that its "not
replacing the file." Don't flush/rename logs which we have
prematurely closed due to write failures, indiciated by
fd[dirn] == -1. Close these files LAST, not before renaming.