]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
http: aliases for htp stream states
authorPhilippe Antoine <pantoine@oisf.net>
Thu, 16 Jan 2025 09:47:50 +0000 (10:47 +0100)
committerVictor Julien <victor@inliniac.net>
Thu, 16 Jan 2025 22:09:08 +0000 (23:09 +0100)
In preparation of libhtp rust

src/app-layer-htp-libhtp.h
src/app-layer-htp.c

index aab53a2ec09440546b24b30b0f7b65fce622c187..ba901a430bd6b2255c82adc863fbb617f51b706e 100644 (file)
@@ -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 */
index 2bc5a9f619a1c449dc96bb059dffb1064e8f5405..8f1aa495459138e308fda7211d4b3c5963523324 100644 (file)
@@ -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;