From: Victor Julien Date: Fri, 26 Jan 2018 10:53:27 +0000 (+0100) Subject: htp: code cleanups X-Git-Tag: suricata-4.1.0-beta1~273 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=07cbbfb0d124e11b99087a40de5056dac7533e5a;p=thirdparty%2Fsuricata.git htp: code cleanups --- diff --git a/src/app-layer-htp.c b/src/app-layer-htp.c index 76c12216de..7d4db5edd4 100644 --- a/src/app-layer-htp.c +++ b/src/app-layer-htp.c @@ -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; }