chmod 755 $HOME/.cargo/bin/cbindgen
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
- run: ./autogen.sh
- - run: CFLAGS="$DEFAULT_CFLAGS -DNDEBUG" ./configure --enable-unittests
+ - run: CFLAGS="$DEFAULT_CFLAGS -DNDEBUG" ./configure --enable-unittests --enable-http2-decompression
- run: make -j2
- run: make check
- run: make dist
])
AM_CONDITIONAL([DEBUG_VALIDATION], [test "x$enable_debug_validation" = "xyes"])
+ # enable http2 decompression
+ AC_ARG_ENABLE(http2-decompression,
+ AS_HELP_STRING([--enable-http2-decompression], [Enable http2 decompression]),[enable_http2_decompression=$enableval],[enable_http2_decompression=no])
+ AS_IF([test "x$enable_http2_decompression" = "xyes"], [
+ AC_DEFINE([HTTP2_DECOMPRESSION],[1],[Enable http2 decompression])
+ ])
+ AM_CONDITIONAL([HTTP2_DECOMPRESSION], [test "x$enable_http2_decompression" = "xyes"])
+
# profiling support
AC_ARG_ENABLE(profiling,
AS_HELP_STRING([--enable-profiling], [Enable performance profiling]),[enable_profiling=$enableval],[enable_profiling=no])
Hyperscan support: ${enable_hyperscan}
Libnet support: ${enable_libnet}
liblz4 support: ${enable_liblz4}
+ HTTP2 decompression: ${enable_http2_decompression}
Rust support: ${enable_rust}
Rust strict mode: ${enable_rust_strict}
debug = []
debug-validate = []
function-macro = []
+decompression = ["flate2", "brotli"]
[dependencies]
nom = "= 5.1.1"
num-traits = "0.2"
widestring = "0.4"
md5 = "0.7.0"
-flate2 = "1.0"
-brotli = "3.3.0"
+flate2 = { version = "1.0", optional = true }
+brotli = { version = "3.3.0", optional = true }
der-parser = "4.0"
kerberos-parser = "0.5"
RUST_FEATURES += debug-validate
endif
+if HTTP2_DECOMPRESSION
+RUST_FEATURES += decompression
+endif
+
if RUST_CROSS_COMPILE
RUST_TARGET = --target $(host_triplet)
endif
*/
use super::files::*;
+#[cfg(feature = "decompression")]
use super::decompression;
use super::parser;
use crate::applayer::{self, *};
pub frames_tc: Vec<HTTP2Frame>,
pub frames_ts: Vec<HTTP2Frame>,
+ #[cfg(feature = "decompression")]
decoder: decompression::HTTP2Decoder,
de_state: Option<*mut core::DetectEngineState>,
state: HTTP2TransactionState::HTTP2StateIdle,
frames_tc: Vec::new(),
frames_ts: Vec::new(),
+ #[cfg(feature = "decompression")]
decoder: decompression::HTTP2Decoder::new(),
de_state: None,
events: std::ptr::null_mut(),
}
}
+ #[cfg(not(feature = "decompression"))]
+ fn handle_headers(&mut self, _blocks: &Vec<parser::HTTP2FrameHeaderBlock>, _dir: u8) {}
+
+ #[cfg(feature = "decompression")]
fn handle_headers(&mut self, blocks: &Vec<parser::HTTP2FrameHeaderBlock>, dir: u8) {
for i in 0..blocks.len() {
if blocks[i].name == "content-encoding".as_bytes().to_vec() {
&'a mut self, input: &'a [u8], dir: u8, sfcm: &'static SuricataFileContext, over: bool,
files: &mut FileContainer, flags: u16,
) -> io::Result<()> {
+ #[cfg(feature = "decompression")]
let mut output = Vec::with_capacity(decompression::HTTP2_DECOMPRESSION_CHUNK_SIZE);
+ #[cfg(feature = "decompression")]
let decompressed = self.decoder.decompress(input, &mut output, dir)?;
+ #[cfg(not(feature = "decompression"))]
+ let decompressed = input;
+
let xid: u32 = self.tx_id as u32;
if dir == STREAM_TOCLIENT {
self.ft_tc.new_chunk(
* 02110-1301, USA.
*/
+#[cfg(feature = "decompression")]
mod decompression;
pub mod detect;
pub mod files;
#ifdef HAVE_NSS
strlcat(features, "HAVE_NSS ", sizeof(features));
#endif
- /* HTTP2_DECOMPRESSION is not an optional feature in this major version */
+#ifdef HTTP2_DECOMPRESSION
strlcat(features, "HTTP2_DECOMPRESSION ", sizeof(features));
+#endif
#ifdef HAVE_LUA
strlcat(features, "HAVE_LUA ", sizeof(features));
#endif