diff --git a/configure.in b/configure.in index 3c993ced48..6e0f065e4e 100644 --- a/configure.in +++ b/configure.in @@ -730,11 +730,14 @@ AC_CHECK_HEADER(pcap.h,,[AC_ERROR(pcap.h not found ...)]) echo exit 1 fi + + AC_CHECK_LIB([htp], [htp_config_register_request_uri_normalize],AC_DEFINE_UNQUOTED([HAVE_HTP_URI_NORMALIZE_HOOK],[1],[Found htp_config_register_request_uri_normalize function in libhtp]) ,,[-lhtp]) ]) #even if we are using an installed htp lib we still need to gen Makefiles inside of htp AC_CONFIG_SUBDIRS([libhtp]) AM_CONDITIONAL([BUILD_LIBHTP], [test "x$enable_non_bundled_htp" = "xno"]) + AM_CONDITIONAL([HAVE_HTP_URI_NORMALIZE_HOOK], [test "x$enable_non_bundled_htp" = "xno"]) # enable CUDA output AC_ARG_ENABLE(cuda, diff --git a/src/app-layer-htp.c b/src/app-layer-htp.c index 195f9862ff..ee8e8f018b 100644 --- a/src/app-layer-htp.c +++ b/src/app-layer-htp.c @@ -666,6 +666,17 @@ void HtpBodyFree(HtpBody *body) body->operation = HTP_BODY_NONE; } +#ifdef HAVE_HTP_URI_NORMALIZE_HOOK +/** + * \brief Normalize the query part of the URI as if it's part of the URI. + * + * \param c HTP connection pointer + * + * \retval HOOK_OK we won't fail + * + * This functionality requires the uri normalize hook introduced in libhtp + * version 0.2.5. + */ static int HTPCallbackRequestUriNormalize(htp_connp_t *c) { SCEnter(); @@ -682,6 +693,7 @@ static int HTPCallbackRequestUriNormalize(htp_connp_t *c) SCReturnInt(HOOK_OK); } +#endif /** * \brief Function callback to append chunks for Requests @@ -887,7 +899,10 @@ static void HTPConfigure(void) cfglist.request_body_limit = HTP_CONFIG_DEFAULT_REQUEST_BODY_LIMIT; htp_config_register_request(cfglist.cfg, HTPCallbackRequest); htp_config_register_response(cfglist.cfg, HTPCallbackResponse); - htp_config_register_request_uri_normalize(cfglist.cfg, HTPCallbackRequestUriNormalize); +#ifdef HAVE_HTP_URI_NORMALIZE_HOOK + htp_config_register_request_uri_normalize(cfglist.cfg, + HTPCallbackRequestUriNormalize); +#endif htp_config_set_generate_request_uri_normalized(cfglist.cfg, 1); default_config = ConfGetNode("libhtp.default-config");