http2: check for HTTP1 protocol during upgrade path

Ticket: 8492
(cherry picked from commit 6ebd0c3cc2)
pull/15433/head
Victor Julien 7 months ago committed by Victor Julien
parent 3e064d4796
commit 75a4641af6

@ -43,6 +43,7 @@ use suricata_sys::sys::{
SCAppLayerParserConfParserEnabled, SCAppLayerParserRegisterLogger,
SCAppLayerProtoDetectConfProtoDetectionEnabled,
};
use suricata_sys::sys::AppProtoEnum::ALPROTO_HTTP1;
static mut ALPROTO_HTTP2: AppProto = ALPROTO_UNKNOWN;
static mut ALPROTO_DOH2: AppProto = ALPROTO_UNKNOWN;
@ -1446,13 +1447,12 @@ extern "C" {
// is typically not unsafe.
#[allow(clippy::not_unsafe_ptr_arg_deref)]
extern "C" fn http2_state_new(
orig_state: *mut std::os::raw::c_void, _orig_proto: AppProto,
orig_state: *mut std::os::raw::c_void, orig_proto: AppProto,
) -> *mut std::os::raw::c_void {
let state = HTTP2State::new();
let boxed = Box::new(state);
let r = Box::into_raw(boxed) as *mut _;
if !orig_state.is_null() {
//we could check ALPROTO_HTTP1 == orig_proto
if !orig_state.is_null() && orig_proto == ALPROTO_HTTP1 as u16 {
unsafe {
HTTP2MimicHttp1Request(orig_state, r);
}

Loading…
Cancel
Save