]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
Added DELETE and PATCH http methods to app-layer-htp.c
authormaxtors <moe.andreas@gmail.com>
Thu, 16 Apr 2015 14:15:10 +0000 (16:15 +0200)
committermaxtors <moe.andreas@gmail.com>
Thu, 23 Apr 2015 11:04:26 +0000 (13:04 +0200)
Added two new http methods to the http decoding done in
app-layer-htp.c so that these messages will be decoded as well.

src/app-layer-htp.c

index db72614862e4f47e9ed638617ee3e7337f393b92..4b25f5f276243125595fcd1d2e46b427f4b0d3b0 100644 (file)
@@ -2657,6 +2657,8 @@ static int HTPSetTxDetectState(void *vtx, DetectEngineState *s)
 static int HTPRegisterPatternsForProtocolDetection(void)
 {
     /* toserver */
+
+    /* GET */
     if (AppLayerProtoDetectPMRegisterPatternCS(IPPROTO_TCP, ALPROTO_HTTP,
                                                "GET|20|", 4, 0, STREAM_TOSERVER) < 0)
     {
@@ -2667,6 +2669,8 @@ static int HTPRegisterPatternsForProtocolDetection(void)
     {
         return -1;
     }
+
+    /* PUT */
     if (AppLayerProtoDetectPMRegisterPatternCS(IPPROTO_TCP, ALPROTO_HTTP,
                                                "PUT|20|", 4, 0, STREAM_TOSERVER) < 0)
     {
@@ -2677,6 +2681,8 @@ static int HTPRegisterPatternsForProtocolDetection(void)
     {
         return -1;
     }
+
+    /* POST */
     if (AppLayerProtoDetectPMRegisterPatternCS(IPPROTO_TCP, ALPROTO_HTTP,
                                                "POST|20|", 5, 0, STREAM_TOSERVER) < 0)
     {
@@ -2687,6 +2693,8 @@ static int HTPRegisterPatternsForProtocolDetection(void)
     {
         return -1;
     }
+
+    /* HEAD */
     if (AppLayerProtoDetectPMRegisterPatternCS(IPPROTO_TCP, ALPROTO_HTTP,
                                                "HEAD|20|", 5, 0, STREAM_TOSERVER) < 0)
     {
@@ -2697,6 +2705,8 @@ static int HTPRegisterPatternsForProtocolDetection(void)
     {
         return -1;
     }
+
+    /* TRACE */
     if (AppLayerProtoDetectPMRegisterPatternCS(IPPROTO_TCP, ALPROTO_HTTP,
                                                "TRACE|20|", 6, 0, STREAM_TOSERVER) < 0)
     {
@@ -2707,6 +2717,8 @@ static int HTPRegisterPatternsForProtocolDetection(void)
     {
         return -1;
     }
+
+    /* OPTIONS */
     if (AppLayerProtoDetectPMRegisterPatternCS(IPPROTO_TCP, ALPROTO_HTTP,
                                                "OPTIONS|20|", 8, 0, STREAM_TOSERVER) < 0)
     {
@@ -2717,6 +2729,8 @@ static int HTPRegisterPatternsForProtocolDetection(void)
     {
         return -1;
     }
+
+    /* CONNECT */
     if (AppLayerProtoDetectPMRegisterPatternCS(IPPROTO_TCP, ALPROTO_HTTP,
                                                "CONNECT|20|", 8, 0, STREAM_TOSERVER) < 0)
     {
@@ -2728,6 +2742,30 @@ static int HTPRegisterPatternsForProtocolDetection(void)
         return -1;
     }
 
+    /* DELETE */
+    if (AppLayerProtoDetectPMRegisterPatternCS(IPPROTO_TCP, ALPROTO_HTTP,
+                                               "DELETE|20|", 7, 0, STREAM_TOSERVER) < 0)
+    {
+        return -1;
+    }
+    if (AppLayerProtoDetectPMRegisterPatternCS(IPPROTO_TCP, ALPROTO_HTTP,
+                                               "DELETE|09|", 7, 0, STREAM_TOSERVER) < 0)
+    {
+        return -1;
+    }
+
+    /* PATCH */
+    if (AppLayerProtoDetectPMRegisterPatternCS(IPPROTO_TCP, ALPROTO_HTTP,
+                                               "PATCH|20|", 6, 0, STREAM_TOSERVER) < 0)
+    {
+        return -1;
+    }
+    if (AppLayerProtoDetectPMRegisterPatternCS(IPPROTO_TCP, ALPROTO_HTTP,
+                                               "PATCH|09|", 6, 0, STREAM_TOSERVER) < 0)
+    {
+        return -1;
+    }
+
     /* toclient */
     if (AppLayerProtoDetectPMRegisterPatternCS(IPPROTO_TCP, ALPROTO_HTTP,
                                                "HTTP/0.9", 8, 0, STREAM_TOCLIENT) < 0)