chiark / gitweb /
Cleanup: Remove an old piece of junk
[cgi-auth-flexible.git] / tests / wrap
1 #!/bin/sh
2
3 # This is part of CGI::Auth::Flexible, a perl CGI authentication module.
4 #
5 # Copyright 2012,2013,2015 Ian Jackson.
6 # Copyright 2012,2013,2015 Citrix.
7 #
8 # This program is free software: you can redistribute it and/or modify
9 # it under the terms of the GNU Affero General Public License as published by
10 # the Free Software Foundation, either version 3 of the License, or
11 # (at your option) any later version, with the "CAF Login Exception"
12 # as published by Ian Jackson (version 1, or at your option any 
13 # later version) as an Additional Permission.
14 #
15 # This program is distributed in the hope that it will be useful,
16 # but WITHOUT ANY WARRANTY; without even the implied warranty of
17 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18 # GNU Affero General Public License for more details.
19
20 set -e
21 cd "$CAFTEST_CAF"
22 : ${CAFTEST_TMP:=tests/tmp}
23 export CAFTEST_TMP
24 exec 2>>$CAFTEST_TMP/wrap.log
25 export HTTP_COOKIE=$(cat "$CAFTEST_TMP/cookie")
26 export CAFTEST_URLBASE=file:///
27 tests/cgi "$@" | perl -pe '
28     next if m/^$/..0;
29     next unless m/Set-Cookie: (\w+=[^; ]+)/;
30     my $cf = "$ENV{CAFTEST_TMP}/cookie";
31     open C, ">", "$cf.new" or die "$cf $!";
32     print C $1 or die $!;
33     close C or die $!;
34     rename "$cf.new", $cf or die "$cf $!";
35 '