http: aliases for htp stream states

In preparation of libhtp rust
pull/12413/head
Philippe Antoine 2 years ago committed by Victor Julien
parent a4479c03f6
commit ef133942e8

@ -78,6 +78,9 @@
#define HTP_METHOD_PUT HTP_M_PUT
#define HTP_METHOD_CONNECT HTP_M_CONNECT
#define HTP_STREAM_STATE_ERROR HTP_STREAM_ERROR
#define HTP_STREAM_STATE_TUNNEL HTP_STREAM_TUNNEL
bstr *SCHTPGenerateNormalizedUri(htp_tx_t *tx, htp_uri_t *uri, bool uri_include_all);
#endif /* SURICATA_APP_LAYER_HTP_LIBHTP__H */

@ -902,7 +902,7 @@ static AppLayerResult HTPHandleRequestData(Flow *f, void *htp_state, AppLayerPar
if (input_len > 0) {
const int r = htp_connp_req_data(hstate->connp, &ts, input, input_len);
switch (r) {
case HTP_STREAM_ERROR:
case HTP_STREAM_STATE_ERROR:
ret = -1;
break;
default:
@ -970,10 +970,10 @@ static AppLayerResult HTPHandleResponseData(Flow *f, void *htp_state, AppLayerPa
if (input_len > 0) {
const int r = htp_connp_res_data(hstate->connp, &ts, input, input_len);
switch (r) {
case HTP_STREAM_ERROR:
case HTP_STREAM_STATE_ERROR:
ret = -1;
break;
case HTP_STREAM_TUNNEL:
case HTP_STREAM_STATE_TUNNEL:
tx = htp_connp_get_out_tx(hstate->connp);
if (tx != NULL && tx->response_status_number == 101) {
htp_header_t *h =
@ -988,7 +988,7 @@ static AppLayerResult HTPHandleResponseData(Flow *f, void *htp_state, AppLayerPa
consumed = (uint32_t)htp_connp_res_data_consumed(hstate->connp);
if (bstr_cmp_c(h->value, "h2c") == 0) {
if (AppLayerProtoDetectGetProtoName(ALPROTO_HTTP2) == NULL) {
// if HTTP2 is disabled, keep the HTP_STREAM_TUNNEL mode
// if HTTP2 is disabled, keep the HTP_STREAM_STATE_TUNNEL mode
break;
}
hstate->slice = NULL;
@ -1004,7 +1004,7 @@ static AppLayerResult HTPHandleResponseData(Flow *f, void *htp_state, AppLayerPa
SCReturnStruct(APP_LAYER_OK);
} else if (bstr_cmp_c_nocase(h->value, "WebSocket") == 0) {
if (AppLayerProtoDetectGetProtoName(ALPROTO_WEBSOCKET) == NULL) {
// if WS is disabled, keep the HTP_STREAM_TUNNEL mode
// if WS is disabled, keep the HTP_STREAM_STATE_TUNNEL mode
break;
}
hstate->slice = NULL;

Loading…
Cancel
Save