Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 10 additions & 5 deletions mod_vhost_limit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -129,18 +129,23 @@ static int handle_r(request_rec *r)

if (data->counter >= conf->max_clients)
{
ap_log_error(APLOG_MARK, APLOG_INFO, 0,NULL,"%s: Access to %s deferred, Max Clients %d exceeded (%d currently)",MOD_NAME, conf->name, conf->max_clients, data->counter);
ap_log_error(APLOG_MARK, APLOG_WARNING, 0,NULL,"%s: Access to %s deferred, Max Clients %d exceeded (%d currently)",MOD_NAME, conf->name, conf->max_clients, data->counter);
return HTTP_SERVICE_UNAVAILABLE;
}

char *s = (char*) apr_pcalloc(pool, sizeof(char)*8);
apr_snprintf(s,8,"%d",conf->sid);
apr_table_t *table = r->connection->notes;
apr_table_setn(table,"sid", s );

apr_atomic_add32(&data->counter,1);

ap_log_error(APLOG_MARK,APLOG_DEBUG|APLOG_NOERRNO, 0 ,NULL, "%s: handling IN %s (%s) = %d", MOD_NAME, conf->name, s, data->counter);
const char *existing_sid = apr_table_get(table, "sid");
if (existing_sid == NULL) {
apr_table_setn(table,"sid", s );
apr_atomic_add32(&data->counter,1);
ap_log_error(APLOG_MARK,APLOG_DEBUG|APLOG_NOERRNO, 0 ,NULL, "%s: handling IN %s (%s) = %d", MOD_NAME, conf->name, s, data->counter);
}
else {
ap_log_error(APLOG_MARK,APLOG_DEBUG|APLOG_NOERRNO, 0 ,NULL, "%s: sid already exists = %d", MOD_NAME, conf->name, s);
}

return DECLINED;
}
Expand Down