--- /dev/null
+#!/bin/sh
+set -e
+cd "$CAFTEST_CAF"
+exec 2>>tests/tmp/log
+export HTTP_COOKIE=$(cat "tests/tmp/cookie")
+export CAFTEST_URL=file:///cgi-bin/wrap
+tests/cgi "$@" | perl -pe '
+ next if m/^$/..0;
+ next unless m/Set-Cookie: (\w+=[^; ]+)/;
+ my $cf = "tests/tmp/cookie";
+ open C, ">", "$cf.new" or die "$cf $!";
+ print C $1 or die $!;
+ close C or die $!;
+ rename "$cf.new", $cf or die "$cf $!";
+'