httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ic...@apache.org
Subject svn commit: r1793531 - in /httpd/test/mod_h2/trunk: conf/modules.conf htdocs/test.example.org/hecho.py test/test_proxy.sh
Date Tue, 02 May 2017 15:23:10 GMT
Author: icing
Date: Tue May  2 15:23:10 2017
New Revision: 1793531

URL: http://svn.apache.org/viewvc?rev=1793531&view=rev
Log:
adding header tests for mod_proxy_http2 X- reverse proxy headers

Modified:
    httpd/test/mod_h2/trunk/conf/modules.conf
    httpd/test/mod_h2/trunk/htdocs/test.example.org/hecho.py
    httpd/test/mod_h2/trunk/test/test_proxy.sh

Modified: httpd/test/mod_h2/trunk/conf/modules.conf
URL: http://svn.apache.org/viewvc/httpd/test/mod_h2/trunk/conf/modules.conf?rev=1793531&r1=1793530&r2=1793531&view=diff
==============================================================================
--- httpd/test/mod_h2/trunk/conf/modules.conf (original)
+++ httpd/test/mod_h2/trunk/conf/modules.conf Tue May  2 15:23:10 2017
@@ -69,6 +69,7 @@ LoadModule proxy_fcgi_module modules/mod
 #LoadModule proxy_wstunnel_module modules/mod_proxy_wstunnel.so
 #LoadModule proxy_ajp_module modules/mod_proxy_ajp.so
 LoadModule proxy_balancer_module modules/mod_proxy_balancer.so
+LoadModule watchdog_module modules/mod_watchdog.so
 LoadModule proxy_hcheck_module modules/mod_proxy_hcheck.so
 #LoadModule proxy_express_module modules/mod_proxy_express.so
 #LoadModule session_module modules/mod_session.so

Modified: httpd/test/mod_h2/trunk/htdocs/test.example.org/hecho.py
URL: http://svn.apache.org/viewvc/httpd/test/mod_h2/trunk/htdocs/test.example.org/hecho.py?rev=1793531&r1=1793530&r2=1793531&view=diff
==============================================================================
--- httpd/test/mod_h2/trunk/htdocs/test.example.org/hecho.py (original)
+++ httpd/test/mod_h2/trunk/htdocs/test.example.org/hecho.py Tue May  2 15:23:10 2017
@@ -8,13 +8,18 @@ try:
     form = cgi.FieldStorage()
     
     # A nested FieldStorage instance holds the file
-    name = form['name']
-    value = form['value']
+    name = form['name'].value
+    value = ''
     
-    # Test if the file was uploaded
-    if name.value:
+    try:
+        value = form['value'].value
+    except KeyError:
+        value = os.environ.get("HTTP_"+name, "unset")
+    
+    # Test if a value was given
+    if name:
         print "Status: 200"
-        print """%s: %s""" % (name.value, value.value,)
+        print """%s: %s""" % (name, value,)
         print """\
 Content-Type: text/plain\n"""
 
@@ -24,7 +29,7 @@ Content-Type: text/plain\n"""
 Content-Type: text/html\n
     <html><body>
     <p>No name and value was specified: %s %s</p>
-    </body></html>""" % (name.value, value.value)
+    </body></html>""" % (name, value)
 
 except KeyError:
     print "Status: 200 Ok"

Modified: httpd/test/mod_h2/trunk/test/test_proxy.sh
URL: http://svn.apache.org/viewvc/httpd/test/mod_h2/trunk/test/test_proxy.sh?rev=1793531&r1=1793530&r2=1793531&view=diff
==============================================================================
--- httpd/test/mod_h2/trunk/test/test_proxy.sh (original)
+++ httpd/test/mod_h2/trunk/test/test_proxy.sh Tue May  2 15:23:10 2017
@@ -119,13 +119,33 @@ large-upload() {
     do-upload 1m 8 --http1.1
 }
 
+curl_check_header() {
+    URL_PREFIX="$1"; shift
+    local NAME="$1"; shift;
+    local VALUE="$1"; shift;
+    rm -rf $TMP
+    mkdir -p "$TMP"
+    echo -e "$( echo "$NAME" |tr [:upper:] [:lower:]): $VALUE\r" > $TMP/expected
+    echo -n "check header $NAME..."
+    ${CURL} "$@" --data "name=$NAME" $URL_PREFIX/hecho.py -D - >$TMP/data.down 2>&1
|| fail
+    fgrep -i "$NAME:" < $TMP/data.down >$TMP/header
+    diff -iu $TMP/expected $TMP/header || fail
+    echo "ok."
+}
+
 if min_httpd_version 2.4.21; then
 
     if min_httpd_version 2.4.26; then
 $SHELL "$TEST_DIR"/test_pph.sh         $HTTPS_AUTH $HTTPS_AUTH_2 \
                                        $HTTP_AUTH $HTTP_AUTH_2           || fail
     fi
-    
+
+if min_httpd_version 2.4.26; then
+    curl_check_header $HTTPS_AUTH/h2proxy "X_FORWARDED_FOR" "127.0.0.1" || fail 
+    curl_check_header $HTTPS_AUTH/h2proxy "X_FORWARDED_HOST" "test.example.org:12346" ||
fail
+    curl_check_header $HTTPS_AUTH/h2proxy "X_FORWARDED_SERVER" "test.example.org" || fail
+fi
+
 $SHELL "$TEST_DIR"/test_interim.sh       $HTTPS_AUTH/h2proxy                  &&
 $SHELL "$TEST_DIR"/test_interim.sh       $HTTPS_AUTH/h2proxy-rewrite          &&
 large-upload $HTTPS_AUTH/h2cproxy                                             &&
@@ -145,6 +165,7 @@ $SHELL "$TEST_DIR"/test_curl_post.sh   $
 $SHELL "$TEST_DIR"/test_nghttp_get.sh  $HTTPS_AUTH/h2proxy                    &&
 $SHELL "$TEST_DIR"/test_nghttp_post.sh $HTTPS_AUTH/h2proxy                    &&
 $SHELL "$TEST_DIR"/test_curl_get.sh    $HTTPS_AUTH/h2proxy                    &&
-$SHELL "$TEST_DIR"/test_curl_post.sh   $HTTPS_AUTH/h2proxy                    &&
+$SHELL "$TEST_DIR"/test_curl_post.sh   $HTTPS_AUTH/h2proxy               || fail
+
 many_engines $HTTPS_AUTH || fail
 fi



Mime
View raw message