[email protected] wrote: > Author: minfrin > Date: Wed Dec 21 10:42:34 2011 > New Revision: 1221668 > > URL: http://svn.apache.org/viewvc?rev=1221668&view=rev > Log: > mod_policy: Add a new testing module to help server administrators > enforce a configurable level of protocol compliance on their > servers and application servers behind theirs. > > Added: > httpd/httpd/trunk/docs/conf/extra/httpd-policy.conf.in > httpd/httpd/trunk/modules/test/mod_policy.c > Modified: > httpd/httpd/trunk/CHANGES > httpd/httpd/trunk/NWGNUmakefile > httpd/httpd/trunk/build/installwinconf.awk > httpd/httpd/trunk/configure.in > httpd/httpd/trunk/docs/conf/httpd.conf.in > httpd/httpd/trunk/modules/test/config.m4 >
> URL: > http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/test/mod_policy.c?rev=1221668&view=auto > ============================================================================== > --- httpd/httpd/trunk/modules/test/mod_policy.c (added) > +++ httpd/httpd/trunk/modules/test/mod_policy.c Wed Dec 21 10:42:34 2011 > + > +static void handle_policy(request_rec *r, policy_result result, > + const char *message, const char *url, apr_bucket_brigade *bb, > + int status) > +{ > + apr_bucket *e; > + > + switch (result) { > + case policy_log: { > + ap_log_rerror( > + APLOG_MARK, > + APLOG_WARNING, > + 0, > + r, > + "mod_policy: violation: %s, uri: %s", > + message, r->uri); > + apr_table_addn(r->headers_out, "Warning", apr_psprintf(r->pool, > + "299 %s \"%s\"", ap_get_server_name(r), message)); What is this 299 about? > + break; > + } > + case policy_enforce: { > + > + ap_log_rerror( > + APLOG_MARK, > + APLOG_ERR, > + 0, > + r, > + "mod_policy: violation, rejecting request: %s, uri: %s", > + message, r->uri); > + apr_table_addn(r->err_headers_out, "Warning", apr_psprintf(r->pool, > + "299 %s \"Rejected: %s\"", ap_get_server_name(r), message)); See above > + apr_table_setn( > + r->notes, "error-notes", > + apr_pstrcat(r->pool, url ? apr_pstrcat(r->pool, "<a > href=\"", > + url, "\">", NULL) : "", message, url ? "</a>" : > "", > + NULL)); > + > + apr_brigade_cleanup(bb); > + e = ap_bucket_error_create(status, NULL, r->pool, > + r->connection->bucket_alloc); > + APR_BRIGADE_INSERT_TAIL(bb, e); > + e = apr_bucket_eos_create(r->connection->bucket_alloc); > + APR_BRIGADE_INSERT_TAIL(bb, e); > + > + } > + case policy_ignore: { > + } > + } > + Regards RĂ¼diger
