1754 |
1754 |
{
|
1755 |
1755 |
SCEnter();
|
1756 |
1756 |
|
|
1757 |
if (need_htp_request_body == 0)
|
|
1758 |
SCReturnInt(HOOK_OK);
|
|
1759 |
|
1757 |
1760 |
#ifdef PRINT
|
1758 |
1761 |
printf("HTPBODY START: \n");
|
1759 |
1762 |
PrintRawDataFp(stdout, (uint8_t *)d->data, d->len);
|
... | ... | |
1874 |
1877 |
{
|
1875 |
1878 |
SCEnter();
|
1876 |
1879 |
|
|
1880 |
if (need_htp_response_body == 0)
|
|
1881 |
SCReturnInt(HOOK_OK);
|
|
1882 |
|
1877 |
1883 |
HtpState *hstate = (HtpState *)d->tx->connp->user_data;
|
1878 |
1884 |
if (hstate == NULL) {
|
1879 |
1885 |
SCReturnInt(HOOK_ERROR);
|
... | ... | |
2230 |
2236 |
htprec->response_body_limit = HTP_CONFIG_DEFAULT_REQUEST_BODY_LIMIT;
|
2231 |
2237 |
htp_config_register_request(htp, HTPCallbackRequest);
|
2232 |
2238 |
htp_config_register_response(htp, HTPCallbackResponse);
|
|
2239 |
htp_config_register_request_body_data(htp,
|
|
2240 |
HTPCallbackRequestBodyData);
|
|
2241 |
htp_config_register_response_body_data(htp,
|
|
2242 |
HTPCallbackResponseBodyData);
|
2233 |
2243 |
#ifdef HAVE_HTP_URI_NORMALIZE_HOOK
|
2234 |
2244 |
htp_config_register_request_uri_normalize(htp,
|
2235 |
2245 |
HTPCallbackRequestUriNormalize);
|
... | ... | |
2410 |
2420 |
SCReturn;
|
2411 |
2421 |
}
|
2412 |
2422 |
|
2413 |
|
/**
|
2414 |
|
* \brief This function is called at the end of SigLoadSignatures. This function
|
2415 |
|
* enables the htp layer to register a callback for the http request body.
|
2416 |
|
* need_htp_request_body is a flag that informs the htp app layer that
|
2417 |
|
* a module in the engine needs the http request body.
|
2418 |
|
*/
|
2419 |
|
void AppLayerHtpRegisterExtraCallbacks(void) {
|
2420 |
|
SCEnter();
|
2421 |
|
SCLogDebug("Registering extra htp callbacks");
|
2422 |
|
|
2423 |
|
HTPCfgRec *p_cfglist = &cfglist;
|
2424 |
|
while (p_cfglist != NULL) {
|
2425 |
|
if (need_htp_request_body == 1) {
|
2426 |
|
SCLogDebug("Registering callback htp_config_register_request_body_data on htp");
|
2427 |
|
htp_config_register_request_body_data(p_cfglist->cfg,
|
2428 |
|
HTPCallbackRequestBodyData);
|
2429 |
|
}
|
2430 |
|
if (need_htp_response_body == 1) {
|
2431 |
|
SCLogDebug("Registering callback htp_config_register_response_body_data on htp");
|
2432 |
|
htp_config_register_response_body_data(p_cfglist->cfg,
|
2433 |
|
HTPCallbackResponseBodyData);
|
2434 |
|
}
|
2435 |
|
p_cfglist = p_cfglist->next;
|
2436 |
|
}
|
2437 |
|
SCReturn;
|
2438 |
|
}
|
2439 |
|
|
2440 |
|
|
2441 |
2423 |
#ifdef UNITTESTS
|
2442 |
2424 |
static HTPCfgRec cfglist_backup;
|
2443 |
2425 |
|