Skip to content

Instantly share code, notes, and snippets.

@inliniac
Created October 1, 2013 11:01
Show Gist options
  • Save inliniac/6776854 to your computer and use it in GitHub Desktop.
Save inliniac/6776854 to your computer and use it in GitHub Desktop.
static int HTPCallbackRequest(htp_tx_t *tx) {
SCEnter();
HtpState *hstate = htp_connp_get_user_data(tx->connp);
if (hstate == NULL) {
SCReturnInt(HTP_ERROR);
}
SCLogDebug("transaction_cnt %"PRIu64", list_size %"PRIu64,
hstate->transaction_cnt, HTPStateGetTxCnt(hstate));
SCLogDebug("HTTP request completed");
if (tx != NULL) {
if (tx->flags & (HTP_REQUEST_INVALID_T_E|HTP_REQUEST_SMUGGLING|HTP_REQUEST_INVALID_C_L|HTP_HOST_MISSING|HTP_HOST_AMBIGUOUS|HTP_AUTH_INVALID))
{
SCLogInfo("TX with events!");
if (tx->flags & HTP_REQUEST_INVALID_T_E)
AppLayerDecoderEventsSetEvent(hstate->f,
HTTP_DECODER_EVENT_INVALID_TRANSFER_ENCODING_VALUE_IN_REQUEST);
if (tx->flags & HTP_REQUEST_INVALID_C_L)
AppLayerDecoderEventsSetEvent(hstate->f,
HTTP_DECODER_EVENT_INVALID_CONTENT_LENGTH_FIELD_IN_REQUEST);
if (tx->flags & HTP_HOST_MISSING)
AppLayerDecoderEventsSetEvent(hstate->f,
HTTP_DECODER_EVENT_MISSING_HOST_HEADER);
if (tx->flags & HTP_HOST_AMBIGUOUS)
AppLayerDecoderEventsSetEvent(hstate->f,
HTTP_DECODER_EVENT_HOST_HEADER_AMBIGUOUS);
}
HtpTxUserData *htud = (HtpTxUserData *)htp_tx_get_user_data(tx);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment