httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ic...@apache.org
Subject svn commit: r1791389 - in /httpd/test/mod_h2/trunk/test: go/h2fuzz.go go/in-get.fuzz go/in-headers-inv.fuzz go/in-headers-many.fuzz go/in-no-eof.fuzz go/test_fuzz.sh test_common.sh test_header.sh
Date Fri, 14 Apr 2017 16:02:59 GMT
Author: icing
Date: Fri Apr 14 16:02:59 2017
New Revision: 1791389

URL: http://svn.apache.org/viewvc?rev=1791389&view=rev
Log:
added test cases for control chars in response headers, added test case for client not sending
EOF on otherwise correct request

Added:
    httpd/test/mod_h2/trunk/test/go/in-no-eof.fuzz
Removed:
    httpd/test/mod_h2/trunk/test/go/in-headers-inv.fuzz
Modified:
    httpd/test/mod_h2/trunk/test/go/h2fuzz.go
    httpd/test/mod_h2/trunk/test/go/in-get.fuzz
    httpd/test/mod_h2/trunk/test/go/in-headers-many.fuzz
    httpd/test/mod_h2/trunk/test/go/test_fuzz.sh
    httpd/test/mod_h2/trunk/test/test_common.sh
    httpd/test/mod_h2/trunk/test/test_header.sh

Modified: httpd/test/mod_h2/trunk/test/go/h2fuzz.go
URL: http://svn.apache.org/viewvc/httpd/test/mod_h2/trunk/test/go/h2fuzz.go?rev=1791389&r1=1791388&r2=1791389&view=diff
==============================================================================
--- httpd/test/mod_h2/trunk/test/go/h2fuzz.go (original)
+++ httpd/test/mod_h2/trunk/test/go/h2fuzz.go Fri Apr 14 16:02:59 2017
@@ -496,6 +496,10 @@ func (app *h2fuzz) cmdStreamEnd(args []s
 }
 
 func (app *h2fuzz) cmdData(args []string) error {
+    flags := map[string]bool {
+        "end": false,
+        "eos": false,
+    }
     if app.eos {
         app.logf("Error: DATA after eos.")
         return nil
@@ -509,8 +513,15 @@ func (app *h2fuzz) cmdData(args []string
     }
     data := bytes.NewBuffer([]byte{})
     data.Grow(1024)
+    args = getFlags(args, flags)
+    i := 0
+    for i < len(args) {
+        data.WriteString(args[i])
+        i += 1
+    }
+
     app.logf("-->[DATA stream=%d, len=%d, eos=%v]", app.streamID, data.Len(), app.eos)
-    return app.framer.WriteData(app.streamID, false, data.Bytes())
+    return app.framer.WriteData(app.streamID, app.eos, data.Bytes())
 }
 
 func (app *h2fuzz) cmdReset(args []string) error {
@@ -597,7 +608,7 @@ func (app *h2fuzz) readFrames() error {
         case *http2.GoAwayFrame:
             app.logf("    Last-Stream-ID = %d; Error-Code = %v (%d)", f.LastStreamID, f.ErrCode,
f.ErrCode)
         case *http2.DataFrame:
-            app.logf("    %q", f.Data())
+            app.logf("    %s", f.Data())
         case *http2.HeadersFrame:
             if f.HasPriority() {
                 app.logf("    PRIORITY = %v", f.Priority)
@@ -607,6 +618,7 @@ func (app *h2fuzz) readFrames() error {
             }
             app.hdec.Write(f.HeaderBlockFragment())
         case *http2.RSTStreamFrame:
+            app.logf("    ErrCode=%d", f.ErrCode)
             app.last_rst = f.StreamID
         }
     }

Modified: httpd/test/mod_h2/trunk/test/go/in-get.fuzz
URL: http://svn.apache.org/viewvc/httpd/test/mod_h2/trunk/test/go/in-get.fuzz?rev=1791389&r1=1791388&r2=1791389&view=diff
==============================================================================
--- httpd/test/mod_h2/trunk/test/go/in-get.fuzz (original)
+++ httpd/test/mod_h2/trunk/test/go/in-get.fuzz Fri Apr 14 16:02:59 2017
@@ -9,6 +9,6 @@ x2: y
 y3: 3
 z4: something
 
-wait 100ms
+wait 1ms
 goaway
 wait

Modified: httpd/test/mod_h2/trunk/test/go/in-headers-many.fuzz
URL: http://svn.apache.org/viewvc/httpd/test/mod_h2/trunk/test/go/in-headers-many.fuzz?rev=1791389&r1=1791388&r2=1791389&view=diff
==============================================================================
--- httpd/test/mod_h2/trunk/test/go/in-headers-many.fuzz (original)
+++ httpd/test/mod_h2/trunk/test/go/in-headers-many.fuzz Fri Apr 14 16:02:59 2017
@@ -1,5 +1,5 @@
 wait 1ms
-stream-get /
+stream-get / eos
 wait 10ms
 headers-add
 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa:
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb

Added: httpd/test/mod_h2/trunk/test/go/in-no-eof.fuzz
URL: http://svn.apache.org/viewvc/httpd/test/mod_h2/trunk/test/go/in-no-eof.fuzz?rev=1791389&view=auto
==============================================================================
--- httpd/test/mod_h2/trunk/test/go/in-no-eof.fuzz (added)
+++ httpd/test/mod_h2/trunk/test/go/in-no-eof.fuzz Fri Apr 14 16:02:59 2017
@@ -0,0 +1,16 @@
+wait 1ms
+stream-get /
+x: y
+y: 3
+z: something
+
+headers-add end
+x2: y
+y3: 3
+z4: something
+content-length: 70
+
+data 1234567890123456789012345678901234567890123456789012345678901234567890
+wait 100ms
+goaway
+wait

Modified: httpd/test/mod_h2/trunk/test/go/test_fuzz.sh
URL: http://svn.apache.org/viewvc/httpd/test/mod_h2/trunk/test/go/test_fuzz.sh?rev=1791389&r1=1791388&r2=1791389&view=diff
==============================================================================
--- httpd/test/mod_h2/trunk/test/go/test_fuzz.sh (original)
+++ httpd/test/mod_h2/trunk/test/go/test_fuzz.sh Fri Apr 14 16:02:59 2017
@@ -79,7 +79,7 @@ if min_httpd_version 2.4.23; then
 check_traffic "$TOP"/in-headers-many.fuzz "checking GET+many headers" <<EOF
 <--[FrameHeader SETTINGS len=6]
 <--[FrameHeader WINDOW_UPDATE len=4]
--->[HEADER stream=1, method=GET, path=/, eoh=false, eos=false]
+-->[HEADER stream=1, method=GET, path=/, eoh=false, eos=true]
 -->[CONTINUATION stream=1, eoh=false, eos=false]
 -->[CONTINUATION stream=1, eoh=false, eos=false]
 -->[CONTINUATION stream=1, eoh=false, eos=false]
@@ -205,4 +205,22 @@ check_resp_headers "$GEN"/in.fuzz "check
 <--[FrameHeader GOAWAY len=8]
 EOF
 
+# check that we auto-close streams that lead to a complete response but fail
+# to send a EOF flag.
+check_traffic "$TOP"/in-no-eof.fuzz "checking GET wo EOF" <<EOF
+<--[FrameHeader SETTINGS len=6]
+<--[FrameHeader WINDOW_UPDATE len=4]
+-->[HEADER stream=1, method=GET, path=/, eoh=false, eos=false]
+-->[CONTINUATION stream=1, eoh=true, eos=false]
+-->[DATA stream=1, len=70, eos=false]
+<--[FrameHeader HEADERS flags=END_HEADERS stream=1 len=XXX]
+    :status = "200"
+<--[FrameHeader DATA stream=1 len=1291]
+<--[FrameHeader DATA flags=END_STREAM stream=1 len=714]
+<--[FrameHeader RST_STREAM stream=1 len=4]
+-->[GOAWAY
+<--[FrameHeader GOAWAY len=8]
+EOF
+
+
 fi

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=1791389&r1=1791388&r2=1791389&view=diff
==============================================================================
--- httpd/test/mod_h2/trunk/test/test_common.sh (original)
+++ httpd/test/mod_h2/trunk/test/test_common.sh Fri Apr 14 16:02:59 2017
@@ -503,10 +503,15 @@ curl_check_fail() {
     local MSG="$1"; shift;
     rm -rf $TMP
     mkdir -p "$(dirname $TMP/$DOC)"
-    cat > $TMP/expected
+    touch $TMP/expected
     echo -n " * curl /$DOC: $MSG..."
-    ${CURL} "$@" $URL_PREFIX/$DOC >$TMP/$DOC 2>&1 && fail "succeeded unexpectedly"
-    diff -u  $TMP/expected $TMP/$DOC || fail
+    if ${CURL} "$@" $URL_PREFIX/$DOC -D - >$TMP/$DOC 2>&1; then
+        status=$( fgrep "HTTP/2 " < $TMP/$DOC >$TMP/status )
+        if test -n "$status"; then
+            test "$status" = "HTTP/2 500" || fail "succeeded with status: $status"
+        fi
+        echo -n "500..."
+    fi
     echo ok.
 }
 

Modified: httpd/test/mod_h2/trunk/test/test_header.sh
URL: http://svn.apache.org/viewvc/httpd/test/mod_h2/trunk/test/test_header.sh?rev=1791389&r1=1791388&r2=1791389&view=diff
==============================================================================
--- httpd/test/mod_h2/trunk/test/test_header.sh (original)
+++ httpd/test/mod_h2/trunk/test/test_header.sh Fri Apr 14 16:02:59 2017
@@ -24,20 +24,54 @@ echo "test headers: $@"
 
 URL_PREFIX="$1"
 
+curl_check_hecho() {
+    local DOC="$1"; shift;
+    local NAME="$1"; shift;
+    local VAL="$1"; shift;
+    local MSG="$1"; shift;
+    rm -rf $TMP
+    mkdir -p "$(dirname $TMP/$DOC)"
+    touch $TMP/expected
+    echo -n " * curl /$DOC: $MSG..."
+    if ${CURL} "$@" --data "name=$NAME&value=$VAL" $URL_PREFIX/$DOC -D - >$TMP/$DOC
2>&1; then
+        status=$( fgrep "HTTP/2 " < $TMP/$DOC >$TMP/status )
+        if test -n "$status"; then
+            test "$status" = "HTTP/2 500" || fail "succeeded with status: $status"
+        fi
+        echo -n "500..."
+    fi
+    echo ok.
+}
+
+
 if min_httpd_version 2.4.19; then
 
 mh2fuzz_check_results / "request with Host, but no :authority..." -f host-header <<EOF
 1/0/0/0/0 (2/3/4/5/0xx)
 EOF
+fi
 
 if min_httpd_version 2.4.24; then
 NGH2_VERSION=$( $NGHTTP --version )
 NGH2_VERSION=${NGH2_VERSION##*/}
 
-if min_version 1.14.0 $NGH2_VERSION; then
-  curl_check_fail index.html "invalid header" -D - -H 'x x: 1'  << EOF
-EOF
-fi
+    if min_version 1.14.0 $NGH2_VERSION; then
+        curl_check_fail index.html "invalid header" -D - -H 'x x: 1'
+    fi
 fi
 
-fi
\ No newline at end of file
+# check invalid chars in response headers
+if min_httpd_version 2.4.26; then
+    for x in 0 1; do
+        for y in 1 2 3 4 5 6 7 8 9 a b c d e f; do
+            curl_check_hecho hecho.py "x%${x}${y}x" "yz" "resp header field \\x${x}${y}"

+            if test "${x}${y}" = "09"; then continue; fi
+            curl_check_hecho hecho.py "x" "y%${x}${y}z" "resp header value \\x${x}${y}"
+        done
+    done
+
+    for x in 10 7F; do
+        curl_check_hecho hecho.py "x%${x}x" "yz" "inv resp header field \\x${x}"
+        curl_check_hecho hecho.py "x" "y%${x}z" "inv resp header value \\x${x}"
+    done
+fi



Mime
View raw message