-
Notifications
You must be signed in to change notification settings - Fork 4
/
mod_limits.h
60 lines (54 loc) · 1.97 KB
/
mod_limits.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
/*
* Copyright (C) 2010-2011 Marian Marinov <[email protected]>
*
* This code is based on the work of David Jao <[email protected]> and
* Maxim Chirkov <[email protected]>, who made mod_limitipconn for Apache 1.3
*
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
*/
#include "httpd.h"
#include "http_config.h"
#include "http_core.h"
#include "http_log.h"
#include "http_main.h"
#include "http_protocol.h"
#include "http_request.h"
#include "util_script.h"
#include "scoreboard.h"
#define MODULE_NAME "mod_limits"
#define MODULE_VERSION "1.1"
#ifndef APACHE_RELEASE
#define APACHE2
#include "http_connection.h"
#include "ap_mpm.h"
#include "apr_strings.h"
#endif
#if defined(AP_SERVER_MAJORVERSION_NUMBER) && AP_SERVER_MAJORVERSION_NUMBER == 2 && defined(AP_SERVER_MINORVERSION_NUMBER) && AP_SERVER_MINORVERSION_NUMBER >= 4
#define APACHE24
#endif
#ifdef APACHE2
static int server_limit, thread_limit;
#endif
typedef struct {
unsigned int ip; // max number of connections per IP
unsigned int uid; // max number of connections per UID
unsigned int vhost; // max number of connections per VHOST
double loadavg; // max load average
double curavg[1]; // current load average
time_t lastavg; // last time we updated the load average
unsigned int checkavg; // how often we will check the load average
} limits_config;