--- mod_limitipconn.c 2008-03-02 17:06:20.000000000 -0600 +++ mod_limitipconn.c 2013-05-02 15:27:55.000000000 -0500 @@ -42,6 +42,8 @@ /* array of MIME types to limit check; all other types are exempt */ apr_array_header_t *excl_limit; + char log_only; + } limitipconn_config; static limitipconn_config *create_config(apr_pool_t *p) @@ -187,8 +189,14 @@ "Rejected, too many connections from this host."); /* set an environment variable */ apr_table_setn(r->subprocess_env, "LIMITIP", "1"); + if (!cfg->log_only) { /* return 503 */ - return HTTP_SERVICE_UNAVAILABLE; + return HTTP_SERVICE_UNAVAILABLE; + } + else { + return DECLINED; + } + } else { ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, "mod_limitipconn: OK: Passed all checks"); @@ -291,6 +299,21 @@ return NULL; } +/* Parse IPLimitOnlyLog Directive */ +static const char *log_only_cmd(cmd_parms *parms, void *mconfig, + int arg) +{ + limitipconn_config *cfg = (limitipconn_config *) mconfig; + limitipconn_config *scfg = (limitipconn_config *) + ap_get_module_config(parms->server->module_config, &limitipconn_module); + + /* Per-directory context */ + cfg->log_only = arg; + /* Per-server context */ + scfg->log_only = arg; + return NULL; +} + /* Parse the OnlyIPLimit directive */ static const char *excl_limit_config_cmd(cmd_parms *parms, void *mconfig, const char *arg) @@ -317,6 +340,8 @@ "maximum simultaneous connections per IP address"), AP_INIT_ITERATE("NoIPLimit", no_limit_config_cmd, NULL, OR_LIMIT|RSRC_CONF, "MIME types for which limit checking is disabled"), + AP_INIT_FLAG("IPLimitOnlyLog", log_only_cmd, NULL, RSRC_CONF, + "only set environment variable and log error, return normally."), AP_INIT_ITERATE("OnlyIPLimit", excl_limit_config_cmd, NULL, OR_LIMIT|RSRC_CONF, "restrict limit checking to these MIME types only"), {NULL},