]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
htp: code cleanups
authorVictor Julien <victor@inliniac.net>
Fri, 26 Jan 2018 10:53:27 +0000 (11:53 +0100)
committerVictor Julien <victor@inliniac.net>
Tue, 30 Jan 2018 13:43:51 +0000 (14:43 +0100)
src/app-layer-htp.c

index 76c12216deb0fe0fee7ba6832009fde5ce30790a..7d4db5edd42e4b9784aae1c016bcc6ca90577b4a 100644 (file)
@@ -721,9 +721,7 @@ static int HTPHandleRequestData(Flow *f, void *htp_state,
                                 void *local_data)
 {
     SCEnter();
-    int r = -1;
     int ret = 1;
-
     HtpState *hstate = (HtpState *)htp_state;
 
     /* On the first invocation, create the connection parser structure to
@@ -740,16 +738,11 @@ static int HTPHandleRequestData(Flow *f, void *htp_state,
     htp_time_t ts = { f->lastts.tv_sec, f->lastts.tv_usec };
     /* pass the new data to the htp parser */
     if (input_len > 0) {
-        r = htp_connp_req_data(hstate->connp, &ts, input, input_len);
-
-        switch(r) {
+        const int r = htp_connp_req_data(hstate->connp, &ts, input, input_len);
+        switch (r) {
             case HTP_STREAM_ERROR:
                 ret = -1;
                 break;
-            case HTP_STREAM_DATA:
-            case HTP_STREAM_DATA_OTHER:
-            case HTP_STREAM_TUNNEL:
-                break;
             default:
                 break;
         }
@@ -791,10 +784,9 @@ static int HTPHandleResponseData(Flow *f, void *htp_state,
                                  void *local_data)
 {
     SCEnter();
-    int r = -1;
     int ret = 1;
-
     HtpState *hstate = (HtpState *)htp_state;
+
     /* On the first invocation, create the connection parser structure to
      * be used by HTP library.  This is looked up via IP in the radix
      * tree.  Failing that, the default HTP config is used.
@@ -808,15 +800,11 @@ static int HTPHandleResponseData(Flow *f, void *htp_state,
 
     htp_time_t ts = { f->lastts.tv_sec, f->lastts.tv_usec };
     if (input_len > 0) {
-        r = htp_connp_res_data(hstate->connp, &ts, input, input_len);
-        switch(r) {
+        const int r = htp_connp_res_data(hstate->connp, &ts, input, input_len);
+        switch (r) {
             case HTP_STREAM_ERROR:
                 ret = -1;
                 break;
-            case HTP_STREAM_DATA:
-            case HTP_STREAM_DATA_OTHER:
-            case HTP_STREAM_TUNNEL:
-                break;
             default:
                 break;
         }