Re: an idea for next generation APT archive caching
Hi, martin f krafft wrote:
> also sprach martin f krafft <madduck@debian.org> [2004.10.20.1155 +0200]:
>> #!/bin/sh -e
>>
>> echo 200 OK
>> echo Content-type: application/x-debian-package
>> echo
>>
>> exec wget -O - $MIRROR/$RPATH | tee $LPATH
>
Don't forget
mkdir -p "$(dirname "$LPATH")"
The above pipe needs either bash 3 or a subshell, if you want to be able
to catch any errors wget might die from.
> one might want to parse wget's error output and return 404 as before
> if it returns 404. then again, in the end, this should be
> implemented in perl of C/C++ anyway.
One more problem -- what happens if client #2 wants the file while the
wget is still in progress?
In other words, you need locking. I'd also ask the remote server for
a Content-Length: (via HEAD or whatever) so that broken transfers can be
detected a bit more reliably.
NB: What to do about no-cache pragmas?
This rapidly turns from a plain 404 error script into a somewhat
nontrivial Perl-or-Python-or-whatever doument handler.
--
Matthias Urlichs | {M:U} IT Design @ m-u-it.de | smurf@smurf.noris.de
Reply to: