From: Philippe Antoine Date: Fri, 3 Sep 2021 09:09:57 +0000 (+0200) Subject: Adds http2 range test X-Git-Tag: suricata-6.0.4~44 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=24a222ca22ba30413e68fc288fd7ced12a995a81;p=thirdparty%2Fsuricata-verify.git Adds http2 range test --- diff --git a/tests/http2-range/README.md b/tests/http2-range/README.md new file mode 100644 index 000000000..3ea272eb8 --- /dev/null +++ b/tests/http2-range/README.md @@ -0,0 +1,14 @@ +# Description + +Test http2 file extraction over multiple transactions with range header. +# PCAP + +The pcap comes from running dummy HTTP1 and HTTP2 server with `go run server.go` with an eicar.txt file in the current directory containing the eicar file +and in parallel as client(s) : +``` +curl -H 'Range: bytes=0-10' --http2 127.0.0.1:8080/eicar +curl -H 'Range: bytes=10-20' 127.0.0.1:8080/eicar +curl -H 'Range: bytes=20-30' --http2 127.0.0.1:8080/eicar +curl -H 'Range: bytes=30-40' 127.0.0.1:8080/eicar +curl -H 'Range: bytes=40-68' --http2 127.0.0.1:8080/eicar +``` diff --git a/tests/http2-range/http2-range.pcap b/tests/http2-range/http2-range.pcap new file mode 100644 index 000000000..0f149a6ca Binary files /dev/null and b/tests/http2-range/http2-range.pcap differ diff --git a/tests/http2-range/server.go b/tests/http2-range/server.go new file mode 100644 index 000000000..1abcb6ad2 --- /dev/null +++ b/tests/http2-range/server.go @@ -0,0 +1,25 @@ +package main + +import ( + "fmt" + "golang.org/x/net/http2" + "golang.org/x/net/http2/h2c" + "net/http" +) + +func main() { + h2s := &http2.Server{} + + handler := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + http.ServeFile(w, r, "eicar.txt") + }) + + server := &http.Server{ + Addr: "0.0.0.0:8080", + Handler: h2c.NewHandler(handler, h2s), + } + + fmt.Printf("Listening [0.0.0.0:8080]...\n") + err := server.ListenAndServe() + fmt.Printf("lol %s", err) +} diff --git a/tests/http2-range/test.yaml b/tests/http2-range/test.yaml new file mode 100644 index 000000000..a3b204d97 --- /dev/null +++ b/tests/http2-range/test.yaml @@ -0,0 +1,21 @@ +requires: + features: + - HAVE_LIBJANSSON + min-version: 7.0.0 + +# disables checksum verification +args: + - -k none --set app-layer.protocols.http2.enabled=true + +checks: + + # Check that there is one file event with total length. + - filter: + count: 1 + match: + event_type: fileinfo + fileinfo.size: 69 + - filter: + count: 0 + match: + event_type: anomaly