On 14 January 2011 c. 02:26:24 Ted Unangst wrote:
> On Sun, Jan 9, 2011 at 5:08 PM, Ted Unangst <[email protected]> wrote:
> > On Sun, 9 Jan 2011, Ted Unangst wrote:
> >
> >> Downloading things can go a lot faster if the server and client support
> >> http compression. This is easily added to the ftp program's http
support.
>
> > Please test, as there are obviously lots of different web servers out
> > there.
>
> Was anyone able to test this?
I wrote a small (kghm) script, and run HOMEPAGEs from ports tree on it.
No problems so far. Maybe someone will want to feed it too...
--
Best wishes,
Vadim Zhukov
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing in e-mail?
#!/bin/sh
usage() {
echo "usage: $0 cmd1 cmd2 ..." >&2
echo "NOTE: all commands should support -o option" >&2
exit 2
}
CMDTIMEOUT=${CMDTIMEOUT:-5}
if [ $# -lt 2 ]; then
usage
fi
set -A cmds -- "$@"
pbase=testing-"`(cd "${TMPDIR:-/tmp}"; mktemp -u XXXXXX)`"
i=0
while read U; do
echo -n "Testing $U ... " >&2
i=$(($i + 1))
prefix="$pbase"-"$i"
failed=
echo "$U" >"$prefix".url || exit 1
for cmd in ${cmds[@]}; do
timer=$CMDTIMEOUT
timed_out=0
(ftp -o "$prefix".out-"$cmd" "$U" >"$prefix".err-"$cmd" 2>&1 ||
\
touch "$prefix".errcode_${?} || exit 1) &
while true; do
sleep 1
timer=$(($timer - 1))
ps -p $! >/dev/null 2>&1 || break
if [ $timer -le 0 ]; then
failed="$failed ${cmd}:timeout";
timed_out=1
break;
fi
done
if [ $timed_out -eq 0 ]; then
errstr="`ls \"$prefix\".errcode_* 2>/dev/null`"
if [ -n "$errstr" ]; then
failed="$failed
${cmd}:${errstr#${prefix}.errcode_}"
fi
fi
done
if [ -n "$failed" ]; then
echo FAILED $failed >&2
continue
fi
set -- ${cmds[@]}
basecmd="$1"
shift
differ=0
while [ $# -gt 0 ]; do
diff -u "$prefix".out-"$basecmd" "$prefix".out-"$1" \
>"$prefix".diff-"$basecmd"-"$1"
case $? in
0)
rm "$prefix".diff-"$basecmd"-"$1"
;;
1)
differ=1
;;
*)
exit 1
;;
esac
shift
done
if [ $differ -eq 0 ]; then
rm "$prefix"*
echo "OK" >&2
else
echo -n "DIFF" >&2
for f in "$prefix".diff-*; do
echo -n " ${f#${prefix}.diff-}" >&2
done
echo >&2
fi
done