aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorDániel Bakai <bakaidl@gmail.com>2019-04-10 12:52:52 +0200
committerPeter Wu <peter@lekensteyn.nl>2019-04-22 15:24:46 +0000
commit9ce60b173bf17b7d20695d9dc1de050989019664 (patch)
tree95ec8b8554415ef2c80d6d9950cc9201c8d22c94 /test
parent51ac1047a7e434a0b2e264780b2fa31f1d986898 (diff)
Add brotli decompression support for HTTP and HTTP2 dissectors.
Change-Id: I9c09f55673187f6fee723fcd72798fb6b9958b03 Reviewed-on: https://code.wireshark.org/review/32745 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot Reviewed-by: Peter Wu <peter@lekensteyn.nl>
Diffstat (limited to 'test')
-rw-r--r--test/captures/http-brotli.pcapngbin0 -> 1840 bytes
-rw-r--r--test/captures/http2-brotli.pcapngbin0 -> 6484 bytes
-rw-r--r--test/fixtures_ws.py1
-rw-r--r--test/suite_dissection.py26
4 files changed, 27 insertions, 0 deletions
diff --git a/test/captures/http-brotli.pcapng b/test/captures/http-brotli.pcapng
new file mode 100644
index 0000000000..5d7a499d1f
--- /dev/null
+++ b/test/captures/http-brotli.pcapng
Binary files differ
diff --git a/test/captures/http2-brotli.pcapng b/test/captures/http2-brotli.pcapng
new file mode 100644
index 0000000000..7e07e857b5
--- /dev/null
+++ b/test/captures/http2-brotli.pcapng
Binary files differ
diff --git a/test/fixtures_ws.py b/test/fixtures_ws.py
index a7d633ac35..161da3f3ce 100644
--- a/test/fixtures_ws.py
+++ b/test/fixtures_ws.py
@@ -169,6 +169,7 @@ def features(cmd_tshark, make_env):
have_libgcrypt17=gcry_m and float(gcry_m.group(1)) >= 1.7,
have_gnutls='with GnuTLS' in tshark_v,
have_pkcs11='and PKCS #11 support' in tshark_v,
+ have_brotli='with brotli' in tshark_v,
)
diff --git a/test/suite_dissection.py b/test/suite_dissection.py
index 9a62e933cc..c9234245cc 100644
--- a/test/suite_dissection.py
+++ b/test/suite_dissection.py
@@ -16,6 +16,20 @@ import fixtures
@fixtures.mark_usefixtures('test_env')
@fixtures.uses_fixtures
+class case_dissect_http(subprocesstest.SubprocessTestCase):
+ def test_http_brotli_decompression(self, cmd_tshark, features, dirs, capture_file):
+ '''HTTP brotli decompression'''
+ if not features.have_brotli:
+ self.skipTest('Requires brotli.')
+ self.assertRun((cmd_tshark,
+ '-r', capture_file('http-brotli.pcapng'),
+ '-Y', 'http.response.code==200',
+ '-Tfields', '-etext',
+ ))
+ self.assertTrue(self.grepOutput('This is a test file for testing brotli decompression in Wireshark'))
+
+@fixtures.mark_usefixtures('test_env')
+@fixtures.uses_fixtures
class case_dissect_http2(subprocesstest.SubprocessTestCase):
def test_http2_data_reassembly(self, cmd_tshark, features, dirs, capture_file):
'''HTTP2 data reassembly'''
@@ -30,6 +44,18 @@ class case_dissect_http2(subprocesstest.SubprocessTestCase):
))
self.assertTrue(self.grepOutput('DATA'))
+ def test_http2_brotli_decompression(self, cmd_tshark, features, dirs, capture_file):
+ '''HTTP2 brotli decompression'''
+ if not features.have_nghttp2:
+ self.skipTest('Requires nghttp2.')
+ if not features.have_brotli:
+ self.skipTest('Requires brotli.')
+ self.assertRun((cmd_tshark,
+ '-r', capture_file('http2-brotli.pcapng'),
+ '-Y', 'http2.data.data matches "This is a test file for testing brotli decompression in Wireshark"',
+ ))
+ self.assertTrue(self.grepOutput('DATA'))
+
@fixtures.mark_usefixtures('test_env')
@fixtures.uses_fixtures
class case_dissect_tcp(subprocesstest.SubprocessTestCase):