diff --git a/src/Makefile.am b/src/Makefile.am index e4af8bcd07..2279f368ef 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -165,6 +165,7 @@ detect-gid.c detect-gid.h \ detect-hostbits.c detect-hostbits.h \ detect-http-accept.c detect-http-accept.h \ detect-http-client-body.c detect-http-client-body.h \ +detect-http-connection.c detect-http-connection.h \ detect-http-cookie.c detect-http-cookie.h \ detect-http-header.c detect-http-header.h \ detect-http-headers.c detect-http-headers.h detect-http-headers-stub.h \ diff --git a/src/detect-http-connection.c b/src/detect-http-connection.c new file mode 100644 index 0000000000..e53f74aa04 --- /dev/null +++ b/src/detect-http-connection.c @@ -0,0 +1,46 @@ +/* Copyright (C) 2007-2017 Open Information Security Foundation + * + * You can copy, redistribute or modify this Program under the terms of + * the GNU General Public License version 2 as published by the Free + * Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * version 2 along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + * 02110-1301, USA. + */ + +/** + * \ingroup httplayer + * + * @{ + */ + + +/** + * \file + * + * \author Victor Julien + * + * Implements the http_connection sticky buffer + */ + +#define KEYWORD_NAME "http_connection" +#define KEYWORD_DOC "http-keywords#http-connection" +#define BUFFER_NAME "http_connection" +#define BUFFER_DESC "http connection header" +#define HEADER_NAME "Connection" +#define KEYWORD_ID DETECT_AL_HTTP_HEADER_CONNECTION +#define KEYWORD_TOSERVER 1 + +#include "detect-http-headers-stub.h" + +void RegisterHttpHeadersConnection(void) +{ + DetectHttpHeadersRegisterStub(); +} diff --git a/src/detect-http-connection.h b/src/detect-http-connection.h new file mode 100644 index 0000000000..7210132232 --- /dev/null +++ b/src/detect-http-connection.h @@ -0,0 +1,23 @@ +/* Copyright (C) 2007-2017 Open Information Security Foundation + * + * You can copy, redistribute or modify this Program under the terms of + * the GNU General Public License version 2 as published by the Free + * Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * version 2 along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + * 02110-1301, USA. + */ + +#ifndef __DETECT_HTTP_CONNECTION_H__ +#define __DETECT_HTTP_CONNECTION_H__ + +void RegisterHttpHeadersConnection(void); + +#endif /* __DETECT_HTTP_CONNECTION_H__ */ diff --git a/src/detect-http-headers.c b/src/detect-http-headers.c index f22cdf108c..91436d580a 100644 --- a/src/detect-http-headers.c +++ b/src/detect-http-headers.c @@ -16,10 +16,12 @@ */ #include "detect-http-accept.h" +#include "detect-http-connection.h" #include "detect-http-referer.h" void DetectHttpHeadersRegister(void) { RegisterHttpHeadersAccept(); RegisterHttpHeadersReferer(); + RegisterHttpHeadersConnection(); } diff --git a/src/detect.h b/src/detect.h index d46dbcd9b4..41764d8904 100644 --- a/src/detect.h +++ b/src/detect.h @@ -1242,6 +1242,7 @@ enum { DETECT_AL_HTTP_HEADER, DETECT_AL_HTTP_HEADER_NAMES, DETECT_AL_HTTP_HEADER_ACCEPT, + DETECT_AL_HTTP_HEADER_CONNECTION, DETECT_AL_HTTP_HEADER_REFERER, DETECT_AL_HTTP_RAW_HEADER, DETECT_AL_HTTP_URI,