Skip to content

Commit

Permalink
http2: do not try to upgrade if http2 is disabled in config
Browse files Browse the repository at this point in the history
  • Loading branch information
catenacyber authored and victorjulien committed Oct 1, 2021
1 parent 42ba421 commit 8536048
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/app-layer-htp.c
Expand Up @@ -925,10 +925,11 @@ static AppLayerResult HTPHandleResponseData(Flow *f, void *htp_state,
if (tx != NULL && tx->response_status_number == 101) {
htp_header_t *h =
(htp_header_t *)htp_table_get_c(tx->response_headers, "Upgrade");
if (h == NULL) {
if (h == NULL || bstr_cmp_c(h->value, "h2c") != 0) {
break;
}
if (bstr_cmp_c(h->value, "h2c") != 0) {
if (AppLayerProtoDetectGetProtoName(ALPROTO_HTTP2) == NULL) {
// if HTTP2 is disabled, keep the HTP_STREAM_TUNNEL mode
break;
}
uint16_t dp = 0;
Expand All @@ -940,8 +941,7 @@ static AppLayerResult HTPHandleResponseData(Flow *f, void *htp_state,
// During HTTP2 upgrade, we may consume the HTTP1 part of the data
// and we need to parser the remaining part with HTTP2
if (consumed > 0 && consumed < input_len) {
SCReturnStruct(
APP_LAYER_INCOMPLETE(consumed, input_len - consumed));
SCReturnStruct(APP_LAYER_INCOMPLETE(consumed, input_len - consumed));
}
SCReturnStruct(APP_LAYER_OK);
}
Expand Down

0 comments on commit 8536048

Please sign in to comment.