w3m in local cgi mode does not appear to honour our attempts to set
cookies. Provide a test-wrap script which fishes the cookie out of
CAF's output and passes it back in on the next run.
Document the necessary rune.
Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
REQUEST_METHOD=post CAHTEST_HOME=`pwd` ./test.cgi ; echo
+CAFTEST_URL=file:/cgi-bin/test-wrap CAHTEST_HOME=`pwd` w3m -cookie -config /dev/null -o cgi_bin=`pwd` file:///cgi-bin/test-wrap
+
update last in db when we return undef from check_divert
--- /dev/null
+#!/bin/sh
+set -e
+exec 2>>"$CAHTEST_HOME/test-data/log"
+export HTTP_COOKIE=$(cat "$CAHTEST_HOME/test-data/cookie")
+./test.cgi "$@" | perl -pe '
+ next if m/^$/..0;
+ next unless m/Set-Cookie: (\w+=[^; ]+)/;
+ my $cf = "$ENV{CAHTEST_HOME}/test-data/cookie";
+ open C, ">", "$cf.new" or die "$cf $!";
+ print C $1 or die $!;
+ close C or die $!;
+ rename "$cf.new", $cf or die "$cf $!";
+'