|
|
f43b499 |
|
|
|
f43b499 |
https://bugzilla.redhat.com/show_bug.cgi?id=809730
|
|
|
f43b499 |
|
|
|
f43b499 |
diff --git a/mod_limitipconn.c b/mod_limitipconn.c
|
|
|
f43b499 |
index d8d2f9a..6262797 100644
|
|
|
f43b499 |
--- mod_limitipconn-0.23/mod_limitipconn.c.httpd24
|
|
|
f43b499 |
+++ mod_limitipconn-0.23/mod_limitipconn.c
|
|
|
f43b499 |
@@ -104,7 +104,11 @@ static int check_limit(request_rec *r, l
|
|
|
f43b499 |
return DECLINED;
|
|
|
f43b499 |
}
|
|
|
f43b499 |
|
|
|
f43b499 |
+#if AP_MODULE_MAGIC_AT_LEAST(20111130,0)
|
|
|
f43b499 |
+ address = r->useragent_ip;
|
|
|
f43b499 |
+#else
|
|
|
f43b499 |
address = r->connection->remote_ip;
|
|
|
f43b499 |
+#endif
|
|
|
f43b499 |
|
|
|
f43b499 |
/* Only check the MIME-type if we have MIME-type stuff in our config.
|
|
|
f43b499 |
The extra subreq can be quite expensive. */
|
|
|
956b60f |
@@ -114,10 +118,12 @@ static int check_limit(request_rec *r, l
|
|
|
956b60f |
* translated into a MIME type. */
|
|
|
956b60f |
content_type = ap_sub_req_lookup_uri(r->uri, r, NULL)->content_type;
|
|
|
f43b499 |
|
|
|
956b60f |
+#if !AP_MODULE_MAGIC_AT_LEAST(20090131, 0)
|
|
|
f43b499 |
/* If there's no Content-type, use the default. */
|
|
|
f43b499 |
if (!content_type) {
|
|
|
f43b499 |
content_type = ap_default_type(r);
|
|
|
f43b499 |
}
|
|
|
956b60f |
+#endif
|
|
|
f43b499 |
|
|
|
f43b499 |
ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r,
|
|
|
956b60f |
"mod_limitipconn: uri: %s Content-Type: %s",
|
|
|
956b60f |
@@ -125,6 +131,9 @@ static int check_limit(request_rec *r, l
|
|
|
956b60f |
|
|
|
956b60f |
/* Cycle through the exempt list; if our content_type is exempt,
|
|
|
956b60f |
* return OK */
|
|
|
956b60f |
+#if AP_MODULE_MAGIC_AT_LEAST(20090131, 0)
|
|
|
956b60f |
+ if (content_type)
|
|
|
956b60f |
+#endif
|
|
|
956b60f |
for (i = 0; i < cfg->no_limit->nelts; i++) {
|
|
|
956b60f |
if ((ap_strcasecmp_match(content_type, nolim[i]) == 0)
|
|
|
956b60f |
|| (strncmp(nolim[i], content_type, strlen(nolim[i])) == 0))
|
|
|
956b60f |
@@ -139,6 +148,10 @@ static int check_limit(request_rec *r, l
|
|
|
956b60f |
* is not present, bail out */
|
|
|
956b60f |
if (cfg->excl_limit->nelts) {
|
|
|
956b60f |
int excused = 1;
|
|
|
956b60f |
+
|
|
|
956b60f |
+#if AP_MODULE_MAGIC_AT_LEAST(20090131, 0)
|
|
|
956b60f |
+ if (content_type)
|
|
|
956b60f |
+#endif
|
|
|
956b60f |
for (i = 0; i < cfg->excl_limit->nelts; i++) {
|
|
|
956b60f |
if ((ap_strcasecmp_match(content_type, exlim[i]) == 0)
|
|
|
956b60f |
||
|
|
|
956b60f |
@@ -160,7 +173,11 @@ static int check_limit(request_rec *r, l
|
|
|
f43b499 |
* this IP address */
|
|
|
f43b499 |
for (i = 0; i < server_limit; ++i) {
|
|
|
f43b499 |
for (j = 0; j < thread_limit; ++j) {
|
|
|
f43b499 |
+#if AP_MODULE_MAGIC_AT_LEAST(20071023, 0)
|
|
|
f43b499 |
+ ws_record = ap_get_scoreboard_worker_from_indexes(i, j);
|
|
|
f43b499 |
+#else
|
|
|
f43b499 |
ws_record = ap_get_scoreboard_worker(i, j);
|
|
|
f43b499 |
+#endif
|
|
|
f43b499 |
switch (ws_record->status) {
|
|
|
f43b499 |
case SERVER_BUSY_READ:
|
|
|
f43b499 |
case SERVER_BUSY_WRITE:
|