From a7abaf538cf92fb29d84b828fc8360925da0160a Mon Sep 17 00:00:00 2001 From: maxtors Date: Thu, 16 Apr 2015 16:15:10 +0200 Subject: [PATCH] Added DELETE and PATCH http methods to app-layer-htp.c 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 | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/src/app-layer-htp.c b/src/app-layer-htp.c index db72614862..4b25f5f276 100644 --- a/src/app-layer-htp.c +++ b/src/app-layer-htp.c @@ -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) -- 2.47.2