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 2016/05/17 14:24:37 UTC
svn commit: r1744280 - in /httpd/test/mod_h2/trunk: Makefile.am
conf/sites/test.example.org.conf conf/sites/test2.example.org.conf
mh2fuzz/mh2f_fuzzer.c test/test_common.sh test/test_fuzz.sh
test/test_h2proxy_load.sh test/test_proxy.sh
Author: icing
Date: Tue May 17 14:24:36 2016
New Revision: 1744280
URL: http://svn.apache.org/viewvc?rev=1744280&view=rev
Log:
adding rewrite proxy_http2 tests, adding header fuzzing
Modified:
httpd/test/mod_h2/trunk/Makefile.am
httpd/test/mod_h2/trunk/conf/sites/test.example.org.conf
httpd/test/mod_h2/trunk/conf/sites/test2.example.org.conf
httpd/test/mod_h2/trunk/mh2fuzz/mh2f_fuzzer.c
httpd/test/mod_h2/trunk/test/test_common.sh
httpd/test/mod_h2/trunk/test/test_fuzz.sh
httpd/test/mod_h2/trunk/test/test_h2proxy_load.sh
httpd/test/mod_h2/trunk/test/test_proxy.sh
Modified: httpd/test/mod_h2/trunk/Makefile.am
URL: http://svn.apache.org/viewvc/httpd/test/mod_h2/trunk/Makefile.am?rev=1744280&r1=1744279&r2=1744280&view=diff
==============================================================================
--- httpd/test/mod_h2/trunk/Makefile.am (original)
+++ httpd/test/mod_h2/trunk/Makefile.am Tue May 17 14:24:36 2016
@@ -223,6 +223,8 @@ proxytx: \
h2proxytx: \
$(SERVER_DIR)/.test-setup
$(H2LOAD) -c 8 -t 8 -n 1000 -m 1 --npn-list=h2 https://$(HTTPS_AUTH_2)/h2proxy/005.txt
+ $(H2LOAD) -c 8 -t 8 -n 1000 -m 1 --npn-list=h2 https://$(HTTPS_AUTH_2)/h2proxy-rewrite/005.txt
+ $(H2LOAD) -c 8 -t 8 -n 1000 -m 1 http://$(HTTP_AUTH)/h2cproxy-rewrite/005.txt
$(H2LOAD) -c 8 -t 8 -n 1000 -m 1 http://$(HTTP_AUTH)/h2cproxy/005.txt
################################################################################
Modified: httpd/test/mod_h2/trunk/conf/sites/test.example.org.conf
URL: http://svn.apache.org/viewvc/httpd/test/mod_h2/trunk/conf/sites/test.example.org.conf?rev=1744280&r1=1744279&r2=1744280&view=diff
==============================================================================
--- httpd/test/mod_h2/trunk/conf/sites/test.example.org.conf (original)
+++ httpd/test/mod_h2/trunk/conf/sites/test.example.org.conf Tue May 17 14:24:36 2016
@@ -135,8 +135,10 @@
<IfModule proxy_http2_module>
ProxyPass "/h2proxy" "balancer://h2-local"
ProxyPassReverse "/h2proxy" "balancer://h2-local"
+ RewriteRule /h2proxy-rewrite(.*) h2://test.example.org:SUBST_PORT_HTTPS_SUBST$1 [P]
ProxyPass "/h2cproxy" "balancer://h2c-local"
ProxyPassReverse "/h2cproxy" "balancer://h2c-local"
+ RewriteRule /h2cproxy-rewrite(.*) h2c://test.example.org:SUBST_PORT_HTTP_SUBST$1 [P]
</IfModule>
<IfVersion >= 2.4.19>
@@ -209,8 +211,10 @@
<IfModule proxy_http2_module>
ProxyPass "/h2proxy" "balancer://h2-local"
ProxyPassReverse "/h2proxy" "balancer://h2-local"
+ RewriteRule /h2proxy-rewrite(.*) h2://test.example.org:SUBST_PORT_HTTPS_SUBST$1 [P]
ProxyPass "/h2cproxy" "balancer://h2c-local"
ProxyPassReverse "/h2cproxy" "balancer://h2c-local"
+ RewriteRule /h2cproxy-rewrite(.*) h2c://test.example.org:SUBST_PORT_HTTP_SUBST$1 [P]
</IfModule>
<Location "/http2-status">
Modified: httpd/test/mod_h2/trunk/conf/sites/test2.example.org.conf
URL: http://svn.apache.org/viewvc/httpd/test/mod_h2/trunk/conf/sites/test2.example.org.conf?rev=1744280&r1=1744279&r2=1744280&view=diff
==============================================================================
--- httpd/test/mod_h2/trunk/conf/sites/test2.example.org.conf (original)
+++ httpd/test/mod_h2/trunk/conf/sites/test2.example.org.conf Tue May 17 14:24:36 2016
@@ -10,6 +10,8 @@
DocumentRoot "SUBST_SERVER_ROOT_SUBST/htdocs/test.example.org"
Protocols http/1.1 h2
+ RewriteEngine on
+
SSLEngine on
SSLCertificateFile conf/ssl/test.example.org.pem
SSLCertificateKeyFile conf/ssl/test.example.org.key
@@ -29,8 +31,10 @@
<IfModule proxy_http2_module>
ProxyPass "/h2proxy" "balancer://h2-local"
ProxyPassReverse "/h2proxy" "balancer://h2-local"
+ RewriteRule /h2proxy-rewrite(.*) h2://test.example.org:SUBST_PORT_HTTPS_SUBST$1 [P]
ProxyPass "/h2cproxy" "balancer://h2c-local"
ProxyPassReverse "/h2cproxy" "balancer://h2c-local"
+ RewriteRule /h2cproxy-rewrite(.*) h2c://test.example.org:SUBST_PORT_HTTP_SUBST$1 [P]
</IfModule>
</VirtualHost>
@@ -59,8 +63,10 @@
<IfModule proxy_http2_module>
ProxyPass "/h2proxy" "balancer://h2-local"
ProxyPassReverse "/h2proxy" "balancer://h2-local"
+ RewriteRule /h2proxy-rewrite(.*) h2://test.example.org:SUBST_PORT_HTTPS_SUBST$1 [P]
ProxyPass "/h2cproxy" "balancer://h2c-local"
ProxyPassReverse "/h2cproxy" "balancer://h2c-local"
+ RewriteRule /h2cproxy-rewrite(.*) h2c://test.example.org:SUBST_PORT_HTTP_SUBST$1 [P]
</IfModule>
</VirtualHost>
Modified: httpd/test/mod_h2/trunk/mh2fuzz/mh2f_fuzzer.c
URL: http://svn.apache.org/viewvc/httpd/test/mod_h2/trunk/mh2fuzz/mh2f_fuzzer.c?rev=1744280&r1=1744279&r2=1744280&view=diff
==============================================================================
--- httpd/test/mod_h2/trunk/mh2fuzz/mh2f_fuzzer.c (original)
+++ httpd/test/mod_h2/trunk/mh2fuzz/mh2f_fuzzer.c Tue May 17 14:24:36 2016
@@ -322,6 +322,84 @@ static h2c_session_obs *hh_create(const
}
/*******************************************************************************
+ * Make a request with a super large header
+ ******************************************************************************/
+ typedef struct fuzzer_slh {
+ h2c_session_obs obs;
+} fuzzer_slh;
+
+static void slh_submit(h2c_session *s, h2c_stream *stream, h2c_request *r,
+ h2c_session_obs *obs)
+{
+ fuzzer_slh *f = obs->ctx;
+ apr_size_t hlen = 16*1024;
+ char *slh;
+
+ if (s->c->verbose > 1) {
+ fprintf(stderr, "h2c_conn(%ld-%d): submit super long header\n",
+ s->c->id, stream->id);
+ }
+
+ slh = apr_pcalloc(stream->p, hlen+1);
+ for (int i = 0; i < hlen; ++i) {
+ slh[i] = 'A';
+ }
+ slh[hlen] = '\0';
+ h2c_request_headers_set(r, "super-long-header", slh);
+}
+
+static h2c_session_obs *slh_create(const char *name, apr_pool_t *p)
+{
+ fuzzer_ds *f;
+ size_t prelen = sizeof("super-long-header")-1;
+
+ f = apr_pcalloc(p, sizeof(*f));
+ f->name = apr_pstrdup(p, name);
+ f->obs.ctx = f;
+ f->obs.before_submit = slh_submit;
+
+ return &f->obs;
+}
+
+/*******************************************************************************
+ * Make a request with a super many header
+ ******************************************************************************/
+ typedef struct fuzzer_smh {
+ h2c_session_obs obs;
+} fuzzer_smh;
+
+static void smh_submit(h2c_session *s, h2c_stream *stream, h2c_request *r,
+ h2c_session_obs *obs)
+{
+ fuzzer_smh *f = obs->ctx;
+ apr_size_t hn = 128;
+ char *name;
+
+ if (s->c->verbose > 1) {
+ fprintf(stderr, "h2c_conn(%ld-%d): submit many long header\n",
+ s->c->id, stream->id);
+ }
+
+ for (int i = 0; i < hn; ++i) {
+ name = apr_psprintf(stream->p, "smh-%d", i);
+ h2c_request_headers_set(r, name, "super many header fuzzing");
+ }
+}
+
+static h2c_session_obs *smh_create(const char *name, apr_pool_t *p)
+{
+ fuzzer_ds *f;
+ size_t prelen = sizeof("super-many-header")-1;
+
+ f = apr_pcalloc(p, sizeof(*f));
+ f->name = apr_pstrdup(p, name);
+ f->obs.ctx = f;
+ f->obs.before_submit = smh_submit;
+
+ return &f->obs;
+}
+
+/*******************************************************************************
* fuzzing factory
******************************************************************************/
@@ -350,5 +428,11 @@ struct h2c_session_obs *mh2f_session_fuz
if (HAS_PREFIX("host-header", name)) {
return hh_create(name, p);
}
+ if (HAS_PREFIX("super-long-header", name)) {
+ return slh_create(name, p);
+ }
+ if (HAS_PREFIX("super-many-header", name)) {
+ return smh_create(name, p);
+ }
return NULL;
}
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=1744280&r1=1744279&r2=1744280&view=diff
==============================================================================
--- httpd/test/mod_h2/trunk/test/test_common.sh (original)
+++ httpd/test/mod_h2/trunk/test/test_common.sh Tue May 17 14:24:36 2016
@@ -91,13 +91,13 @@ if min_version 2.4.19; then
EXP_H1_HTTP2=""
EXP_H2_H2PUSH=""
;;
- */h2proxy)
+ */h2proxy|*/h2proxy-rewrite)
EXP_HTTP2="on"
EXP_H2PUSH="off"
EXP_H1_HTTP2="${EXP_HTTP2}"
EXP_H1_H2PUSH="${EXP_H2PUSH}"
;;
- */h2cproxy)
+ */h2cproxy|*/h2cproxy-rewrite)
EXP_HTTP2="on"
EXP_H2PUSH="off"
EXP_H1_HTTP2="${EXP_HTTP2}"
@@ -116,13 +116,13 @@ case "$URL_PREFIX" in
*/proxy|*/rewrite)
EXP_PROTOCOL="HTTP/1.1"
;;
- */h2proxy)
+ */h2proxy|*/h2proxy-rewrite)
EXP_HTTPS="on"
EXP_PROTOCOL="${HTTP2_PROTOCOL}"
EXP_H1_PROTOCOL="${EXP_PROTOCOL}"
EXP_SSL_PROTOCOL="TLSv1.2"
;;
- */h2cproxy)
+ */h2cproxy|*/h2cproxy-rewrite)
EXP_HTTPS=""
EXP_SSL_PROTOCOL=""
EXP_PROTOCOL="${HTTP2_PROTOCOL}"
Modified: httpd/test/mod_h2/trunk/test/test_fuzz.sh
URL: http://svn.apache.org/viewvc/httpd/test/mod_h2/trunk/test/test_fuzz.sh?rev=1744280&r1=1744279&r2=1744280&view=diff
==============================================================================
--- httpd/test/mod_h2/trunk/test/test_fuzz.sh (original)
+++ httpd/test/mod_h2/trunk/test/test_fuzz.sh Tue May 17 14:24:36 2016
@@ -135,8 +135,29 @@ fuzz-delay() {
echo "ok."
}
+fuzz-header() {
+ URL="$1"; shift;
+ echo -n " * on $URL: "
+ cat > $GEN/expected << EOF
+--> 0:00001 GET / -> 431 0
+0/0/1/0/0 (2/3/4/5/0xx)
+EOF
+ echo -n "super-long..."
+ $MH2FUZZ -c 1 -m 1 -n 1 -f super-long-header $URL/ > $GEN/result 2>&1 || fail
+ diff -u $GEN/expected $GEN/result || fail
+ echo -n "super-many..."
+ $MH2FUZZ -c 1 -m 1 -n 1 -f super-many-header $URL/ > $GEN/result 2>&1 || fail
+ diff -u $GEN/expected $GEN/result || fail
+ echo "ok."
+}
+
+
+echo "fuzz header"
+fuzz-header $HTTP_AUTH || fail
+fuzz-header $HTTPS_AUTH || fail
+
echo "fuzz upload"
-fuzz-upload $HTTP_AUTH
+fuzz-upload $HTTP_AUTH || fail
echo "test frames sent/recv on GETs"
$SHELL "$TEST_DIR"/test_frames.sh $HTTP_AUTH $HTTPS_AUTH || fail
Modified: httpd/test/mod_h2/trunk/test/test_h2proxy_load.sh
URL: http://svn.apache.org/viewvc/httpd/test/mod_h2/trunk/test/test_h2proxy_load.sh?rev=1744280&r1=1744279&r2=1744280&view=diff
==============================================================================
--- httpd/test/mod_h2/trunk/test/test_h2proxy_load.sh (original)
+++ httpd/test/mod_h2/trunk/test/test_h2proxy_load.sh Tue May 17 14:24:36 2016
@@ -44,7 +44,7 @@ EOF
load_suite() {
URL_PREFIX="$1"; shift
- local n=10000
+ local n="$1"; shift
echo "loading $URL_PREFIX $n requests"
load_run " 1 connection " $n -c 1 -t 1 -m 100
@@ -58,7 +58,9 @@ load_suite() {
if min_version 2.4.21; then
-load_suite $HTTPS_AUTH_2/h2proxy
-load_suite $HTTPS_AUTH_2/h2cproxy
+load_suite $HTTPS_AUTH_2/h2proxy 10000
+load_suite $HTTPS_AUTH_2/h2proxy-rewrite 1000
+load_suite $HTTPS_AUTH_2/h2cproxy 10000
+load_suite $HTTPS_AUTH_2/h2cproxy-rewrite 1000
fi
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=1744280&r1=1744279&r2=1744280&view=diff
==============================================================================
--- httpd/test/mod_h2/trunk/test/test_proxy.sh (original)
+++ httpd/test/mod_h2/trunk/test/test_proxy.sh Tue May 17 14:24:36 2016
@@ -40,13 +40,23 @@ $URL_PREFIX/h2proxy/004/gophertiles_002.
$URL_PREFIX/h2proxy/004/gophertiles_003.jpg
$URL_PREFIX/h2proxy/004/gophertiles_004.jpg
$URL_PREFIX/h2proxy/004/gophertiles_005.jpg
+$URL_PREFIX/h2proxy-rewrite/004.html
+$URL_PREFIX/h2proxy-rewrite/004/gophertiles_002.jpg
+$URL_PREFIX/h2proxy-rewrite/004/gophertiles_003.jpg
+$URL_PREFIX/h2proxy-rewrite/004/gophertiles_004.jpg
+$URL_PREFIX/h2proxy-rewrite/004/gophertiles_005.jpg
$URL_PREFIX/h2cproxy/004.html
$URL_PREFIX/h2cproxy/004/gophertiles_002.jpg
$URL_PREFIX/h2cproxy/004/gophertiles_003.jpg
$URL_PREFIX/h2cproxy/004/gophertiles_004.jpg
$URL_PREFIX/h2cproxy/004/gophertiles_005.jpg
+$URL_PREFIX/h2cproxy-rewrite/004.html
+$URL_PREFIX/h2cproxy-rewrite/004/gophertiles_002.jpg
+$URL_PREFIX/h2cproxy-rewrite/004/gophertiles_003.jpg
+$URL_PREFIX/h2cproxy-rewrite/004/gophertiles_004.jpg
+$URL_PREFIX/h2cproxy-rewrite/004/gophertiles_005.jpg
EOF
- h2load_check_requests "loading from 2 proxied locations" \
+ h2load_check_requests "loading from 4 proxied locations" \
-i $TMP/urls.txt -n 10000 -c 1 -t 1 -m 100 <<EOF
requests: 10000 total, 10000 started, 10000 done, 10000 succeeded, 0 failed, 0 errored, 0 timeout
EOF
@@ -54,10 +64,18 @@ EOF
if min_version 2.4.21; then
+$SHELL "$TEST_DIR"/test_nghttp_get.sh $HTTPS_AUTH/h2cproxy-rewrite &&
+$SHELL "$TEST_DIR"/test_nghttp_post.sh $HTTPS_AUTH/h2cproxy-rewrite &&
+$SHELL "$TEST_DIR"/test_curl_get.sh $HTTPS_AUTH/h2cproxy-rewrite &&
+$SHELL "$TEST_DIR"/test_curl_post.sh $HTTPS_AUTH/h2cproxy-rewrite &&
$SHELL "$TEST_DIR"/test_nghttp_get.sh $HTTPS_AUTH/h2cproxy &&
$SHELL "$TEST_DIR"/test_nghttp_post.sh $HTTPS_AUTH/h2cproxy &&
$SHELL "$TEST_DIR"/test_curl_get.sh $HTTPS_AUTH/h2cproxy &&
$SHELL "$TEST_DIR"/test_curl_post.sh $HTTPS_AUTH/h2cproxy &&
+$SHELL "$TEST_DIR"/test_nghttp_get.sh $HTTPS_AUTH/h2proxy-rewrite &&
+$SHELL "$TEST_DIR"/test_nghttp_post.sh $HTTPS_AUTH/h2proxy-rewrite &&
+$SHELL "$TEST_DIR"/test_curl_get.sh $HTTPS_AUTH/h2proxy-rewrite &&
+$SHELL "$TEST_DIR"/test_curl_post.sh $HTTPS_AUTH/h2proxy-rewrite &&
$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 &&