httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ic...@apache.org
Subject svn commit: r1715364 - in /httpd/test/mod_h2/trunk: htdocs/test.example.org/echohd.py test/test_common.sh test/test_push.sh test/test_trailer.sh
Date Fri, 20 Nov 2015 13:59:02 GMT
Author: icing
Date: Fri Nov 20 13:59:01 2015
New Revision: 1715364

URL: http://svn.apache.org/viewvc?rev=1715364&view=rev
Log:
adding more trailer tests

Added:
    httpd/test/mod_h2/trunk/htdocs/test.example.org/echohd.py
Modified:
    httpd/test/mod_h2/trunk/test/test_common.sh
    httpd/test/mod_h2/trunk/test/test_push.sh
    httpd/test/mod_h2/trunk/test/test_trailer.sh

Added: httpd/test/mod_h2/trunk/htdocs/test.example.org/echohd.py
URL: http://svn.apache.org/viewvc/httpd/test/mod_h2/trunk/htdocs/test.example.org/echohd.py?rev=1715364&view=auto
==============================================================================
--- httpd/test/mod_h2/trunk/htdocs/test.example.org/echohd.py (added)
+++ httpd/test/mod_h2/trunk/htdocs/test.example.org/echohd.py Fri Nov 20 13:59:01 2015
@@ -0,0 +1,22 @@
+#!/usr/bin/env python
+import cgi, os
+import cgitb; cgitb.enable()
+
+status = '200 Ok'
+
+form = cgi.FieldStorage()
+name = form.getvalue('name')
+
+if name:
+    print "Status: 200"
+    print """\
+Content-Type: text/plain\n"""
+    print """%s: %s""" % (name, os.environ['HTTP_'+name])
+else:
+    print "Status: 400 Parameter Missing"
+    print """\
+Content-Type: text/html\n
+<html><body>
+<p>No name was specified</p>
+</body></html>"""
+

Modified: httpd/test/mod_h2/trunk/test/test_common.sh
URL: http://svn.apache.org/viewvc/httpd/test/mod_h2/trunk/test/test_common.sh?rev=1715364&r1=1715363&r2=1715364&view=diff
==============================================================================
--- httpd/test/mod_h2/trunk/test/test_common.sh (original)
+++ httpd/test/mod_h2/trunk/test/test_common.sh Fri Nov 20 13:59:01 2015
@@ -295,7 +295,6 @@ nghttp_post_file() {
     DOC="$1"; shift;
     FILE="$1"; shift;
     MSG="$1"; shift;
-    ARGS="$@"$ARG_UPGRADE
     fname="$(basename $FILE)"
     rm -rf $TMP
     mkdir -p $TMP
@@ -316,13 +315,34 @@ EOF
 --DSAJKcd9876--
 EOF
     echo -n " * nghttp /$DOC: $MSG..."
-    ${NGHTTP} -v $ARGS --data=$TMP/updata -H'Content-Type: multipart/form-data; boundary=DSAJKcd9876'
$URL_PREFIX/$DOC > $TMP/$DOC || fail "error uploading $fname"
-
+    ${NGHTTP} -v "$@"$ARG_UPGRADE --data=$TMP/updata -H'Content-Type: multipart/form-data;
boundary=DSAJKcd9876' $URL_PREFIX/$DOC > $TMP/$DOC || fail "error uploading $fname"
     ${NGHTTP} $ARG_UPGRADE $URL_PREFIX/files/"$fname" > $TMP/data.down || fail "error
downloding $fname"
     diff  $FILE $TMP/data.down || fail
     echo ok.
 }
 
+nghttp_post_name() {
+    DOC="$1"; shift;
+    NAME="$1"; shift;
+    MSG="$1"; shift;
+    fname="$(basename $FILE)"
+    rm -rf $TMP
+    mkdir -p $TMP
+    cat > $TMP/expected
+    cat > $TMP/updata <<EOF
+--DSAJKcd9876
+Content-Disposition: form-data; name="value"; filename="xxxxx"
+Content-Type: text/plain
+
+$NAME
+--DSAJKcd9876
+EOF
+    echo -n " * nghttp /$DOC: $MSG..."
+    ${NGHTTP} "$@"$ARG_UPGRADE --data=$TMP/updata -H'Content-Type: multipart/form-data; boundary=DSAJKcd9876'
$URL_PREFIX/$DOC > $TMP/$DOC || fail "error uploading form"
+    diff  $TMP/expected $TMP/$DOC || fail
+    echo ok.
+}
+
 nghttp_post_data() {
     DOC="$1"; shift;
     FILE="$1"; shift;

Modified: httpd/test/mod_h2/trunk/test/test_push.sh
URL: http://svn.apache.org/viewvc/httpd/test/mod_h2/trunk/test/test_push.sh?rev=1715364&r1=1715363&r2=1715364&view=diff
==============================================================================
--- httpd/test/mod_h2/trunk/test/test_push.sh (original)
+++ httpd/test/mod_h2/trunk/test/test_push.sh Fri Nov 20 13:59:01 2015
@@ -15,7 +15,7 @@
 #
 
 source $(dirname $0)/test_common.sh
-echo "test server push"
+echo "test server push: $@"
 
 ################################################################################
 # check announcements of upgrade: possibilities

Modified: httpd/test/mod_h2/trunk/test/test_trailer.sh
URL: http://svn.apache.org/viewvc/httpd/test/mod_h2/trunk/test/test_trailer.sh?rev=1715364&r1=1715363&r2=1715364&view=diff
==============================================================================
--- httpd/test/mod_h2/trunk/test/test_trailer.sh (original)
+++ httpd/test/mod_h2/trunk/test/test_trailer.sh Fri Nov 20 13:59:01 2015
@@ -15,7 +15,7 @@
 #
 
 source $(dirname $0)/test_common.sh
-echo "test trailers"
+echo "test trailers: $@"
 
 ################################################################################
 # check announcements of upgrade: possibilities
@@ -25,14 +25,35 @@ echo "test trailers"
 URL_PREFIX="$1"
 
 if min_version 2.5.0; then
+    # basic test if we survive trailers via HTTP/2 at all
+    # single
     nghttp_post_data echo.py $GEN/data-1k "1 trailer" \
         --trailer "test: 1"
-
+    # double
     nghttp_post_data echo.py $GEN/data-1k "2 trailers" \
         --trailer "test: 2" --trailer "XXX: test"
-
+    # no content-length
     nghttp_post_data echo.py $GEN/data-1k "1 trailer w/o c-len" \
         --trailer "test: 3" --no-content-length 
+
+    # check that we see a normal header as expected
+    nghttp_check_content echohd.py'?name=X' "echo header" \
+        -H 'X: 1' <<EOF
+X: 1
+EOF
+    # check if we also see a POSTed header
+    nghttp_post_name echohd.py'?name=X' Y "post+header" \
+        -H "X: 2" <<EOF
+X: 2
+EOF
+    # check that in CGI, headers are visible, but trailers not
+    nghttp_post_name echohd.py'?name=X' Y "post+trailer" \
+        -H "X: 3" --trailer "X: 4" <<EOF
+X: 3
+EOF
+
+    # TODO: we lack a test that shows the trailer is available 
+    # at the request *after* the content is read
 else
     echo "trailer tests require httpd >= 2.5.0"
 fi
\ No newline at end of file



Mime
View raw message