You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by ic...@apache.org on 2015/10/26 12:25:54 UTC

svn commit: r1710570 - in /httpd/test/mod_h2/trunk: Makefile.am conf/sites/ conf/ssl/ test/test_common.sh test/test_upgrade.sh

Author: icing
Date: Mon Oct 26 11:25:53 2015
New Revision: 1710570

URL: http://svn.apache.org/viewvc?rev=1710570&view=rev
Log:
adding tests for upgrade announcements

Added:
    httpd/test/mod_h2/trunk/test/test_upgrade.sh
Modified:
    httpd/test/mod_h2/trunk/Makefile.am
    httpd/test/mod_h2/trunk/conf/sites/   (props changed)
    httpd/test/mod_h2/trunk/conf/ssl/   (props changed)
    httpd/test/mod_h2/trunk/test/test_common.sh

Modified: httpd/test/mod_h2/trunk/Makefile.am
URL: http://svn.apache.org/viewvc/httpd/test/mod_h2/trunk/Makefile.am?rev=1710570&r1=1710569&r2=1710570&view=diff
==============================================================================
--- httpd/test/mod_h2/trunk/Makefile.am (original)
+++ httpd/test/mod_h2/trunk/Makefile.am Mon Oct 26 11:25:53 2015
@@ -118,6 +118,7 @@ test: \
 	@$(TESTRUN) test/test_proto_order.sh https://$(HTTPS_AUTH) https://$(HTTPS_AUTH_2)
 	@$(TESTRUN) test/test_alt_host.sh    https://$(HTTPS_AUTH) https://$(HTTPS_AUTH_2)
 	@$(TESTRUN) test/test_renegotiate.sh https://$(HTTPS_AUTH)
+	@$(TESTRUN) test/test_upgrade.sh     http://$(HTTP_AUTH) https://$(HTTPS_AUTH)
 	@$(TESTRUN) test/test_nghttp_get.sh  https://$(HTTPS_AUTH)
 	@$(TESTRUN) test/test_nghttp_post.sh https://$(HTTPS_AUTH)
 	@$(TESTRUN) test/test_curl_get.sh    https://$(HTTPS_AUTH)

Propchange: httpd/test/mod_h2/trunk/conf/sites/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Mon Oct 26 11:25:53 2015
@@ -0,0 +1 @@
+mod-h2.greenbytes.de.conf

Propchange: httpd/test/mod_h2/trunk/conf/ssl/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Mon Oct 26 11:25:53 2015
@@ -0,0 +1,2 @@
+mod-h2.greenbytes.de*
+ca.pem

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=1710570&r1=1710569&r2=1710570&view=diff
==============================================================================
--- httpd/test/mod_h2/trunk/test/test_common.sh (original)
+++ httpd/test/mod_h2/trunk/test/test_common.sh Mon Oct 26 11:25:53 2015
@@ -156,6 +156,21 @@ curl_check_status() {
     echo ok.
 }
 
+curl_check_upgrade() {
+    DOC="$1"; shift;
+    UPGRADE="$1"; shift;
+    MSG="$1"; shift;
+    rm -rf $TMP
+    mkdir -p "$(dirname $TMP/$DOC)"
+    echo -n " * curl /$DOC: $MSG..."
+    ${CURL} -D - "$@" $URL_PREFIX/$DOC > $TMP/$DOC 2>&1 || fail "ret: $?"
+    found=$( fgrep -i 'Upgrade: ' $TMP/$DOC | tr -d '\n\r')
+    if test "$UPGRADE" != "$found"; then
+        fail "expected: '$UPGRADE', got: $found"
+    fi
+    echo ok.
+}
+
 curl_check_content() {
     DOC="$1"; shift;
     MSG="$1"; shift;

Added: httpd/test/mod_h2/trunk/test/test_upgrade.sh
URL: http://svn.apache.org/viewvc/httpd/test/mod_h2/trunk/test/test_upgrade.sh?rev=1710570&view=auto
==============================================================================
--- httpd/test/mod_h2/trunk/test/test_upgrade.sh (added)
+++ httpd/test/mod_h2/trunk/test/test_upgrade.sh Mon Oct 26 11:25:53 2015
@@ -0,0 +1,42 @@
+#!/bin/bash
+# Copyright 2015 greenbytes GmbH (https://www.greenbytes.de)
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+source $(dirname $0)/test_common.sh
+echo "test upgrade headers: http vs. https"
+
+################################################################################
+# check announcements of upgrade: possibilities
+################################################################################
+
+
+URL_HTTP="$1"
+URL_HTTPS="$2"
+
+URL_PREFIX="$URL_HTTP"
+
+# should see an announcement of h2c
+#
+curl_check_upgrade index.html "Upgrade: h2c" "expecting h2c"
+curl_check_upgrade index.html "" "expecting none" -H'Host: noh2.example.org'
+
+
+
+URL_PREFIX="$URL_HTTPS"
+
+# should see an announcement of h2
+#
+curl_check_upgrade index.html "Upgrade: h2" "expecting h2"
+curl_check_upgrade index.html "" "expecting none" -H'Host: noh2.example.org'