Skip to content
This repository has been archived by the owner on Nov 8, 2023. It is now read-only.

Commit

Permalink
Added specific internal naxsi rule (id:15) for empty/0 content length…
Browse files Browse the repository at this point in the history
… POST requests
  • Loading branch information
bui committed Dec 4, 2013
1 parent 328074f commit 3ff8232
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion naxsi_src/naxsi_runtime.c
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,14 @@ ngx_http_rule_t nx_int__uncommon_post_boundary = {/*type*/ 0, /*whitelist flag*/
/*block*/ 1, /*allow*/ 0, /*drop*/ 0, /*log*/ 0,
/*br ptrs*/ NULL};

ngx_http_rule_t nx_int__empty_post_body = {/*type*/ 0, /*whitelist flag*/ 0,
/*wl_id ptr*/ NULL, /*rule_id*/ 15,
/*log_msg*/ NULL, /*score*/ 0,
/*sscores*/ NULL,
/*sc_block*/ 1, /*sc_allow*/ 0,
/*block*/ 1, /*allow*/ 0, /*drop*/ 0, /*log*/ 0,
/*br ptrs*/ NULL};



#define dummy_error_fatal(ctx, r, ...) do { \
Expand Down Expand Up @@ -1834,7 +1842,12 @@ ngx_http_dummy_body_parse(ngx_http_request_ctx_t *ctx,
ngx_log_debug(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
"XX-BODY PARSE");
#endif
if (!r->request_body->bufs || !r->headers_in.content_type) {

if (!r->request_body->bufs) {
ngx_http_apply_rulematch_v_n(&nx_int__empty_post_body, ctx, r, NULL, NULL, BODY, 1, 0);
return ;
}
if (!r->headers_in.content_type) {
#ifdef dummy_body_parse_debug
ngx_log_debug(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
"XX-No content type ..");
Expand Down

0 comments on commit 3ff8232

Please # to comment.