summaryrefslogtreecommitdiff
path: root/testing/http-unwrap
diff options
context:
space:
mode:
authorDaniel Silverstone <dsilvers@digital-scurf.org>2017-07-31 14:39:54 -0400
committerDaniel Silverstone <dsilvers@digital-scurf.org>2017-07-31 16:58:58 -0400
commitab55ba5174097b25fe7227d1aa4e6559cc40b978 (patch)
treee7ea6061d364204760cd612b0ea4c7deb3a822ec /testing/http-unwrap
parent5a3619ec799578f4aaf57e164a27648bf86ae077 (diff)
downloadgitano-ab55ba5174097b25fe7227d1aa4e6559cc40b978.tar.gz
Test suite properly runs gitano-command.cgi
In order to make this work, I had to rework password handling in the test suite, and also redo the http unwrapper to use wget instead of executing the cgi directly. All yarn IMPLEMENTs which use $GTT runcommand and don't pass the stdin, *MUST* explicitly use </dev/null to prevent hangs in http mode.
Diffstat (limited to 'testing/http-unwrap')
-rwxr-xr-xtesting/http-unwrap38
1 files changed, 23 insertions, 15 deletions
diff --git a/testing/http-unwrap b/testing/http-unwrap
index 5c05544..22392d2 100755
--- a/testing/http-unwrap
+++ b/testing/http-unwrap
@@ -27,18 +27,26 @@
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
-"$@" | (
- OIFS="$IFS";
- IFS="
-";
- read STATUSLINE;
- read BLANKLINE;
- IFS="$OIFS";
- OKLINE=${STATUSLINE##Status: 200}
- if test x"$OKLINE" = x"$STATUSLINE"; then
- cat >&2
- exit 1
- else
- cat
- fi
-)
+INFILE=$(mktemp -p "$DATADIR")
+OUTFILE=$(mktemp -p "$DATADIR")
+cleanup () {
+ rm -f "$OUTFILE"
+ rm -f "$INFILE"
+}
+trap cleanup 0
+
+cat > "$INFILE"
+
+if test $(stat -c %s "$INFILE") != "0"; then
+ wget -q -O- --content-on-error --auth-no-challenge --post-file="$INFILE" "$@" > "$OUTFILE" 2>&1
+else
+ wget -q -O- --content-on-error --auth-no-challenge "$@" > "$OUTFILE" 2>&1
+fi
+RES="$?"
+if test "$RES" = "0"; then
+ cat "$OUTFILE"
+ exit 0
+else
+ cat >&2 "$OUTFILE"
+ exit 1
+fi