From 1f44c47077aa4994950eac9cec8e449c4e49f565 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Wed, 13 Jun 2012 18:43:31 +0200 Subject: reorg repo --- Makefile | 4 ++ mod_limitipconn-0.23-httpd24.patch | 65 ++++++++++++++++++++++++++ mod_limitipconn.conf | 15 ++++++ mod_limitipconn.spec | 96 ++++++++++++++++++++++++++++++++++++++ 4 files changed, 180 insertions(+) create mode 100644 Makefile create mode 100644 mod_limitipconn-0.23-httpd24.patch create mode 100644 mod_limitipconn.conf create mode 100644 mod_limitipconn.spec diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..1e65467 --- /dev/null +++ b/Makefile @@ -0,0 +1,4 @@ +SRCDIR := $(shell pwd) +NAME := $(shell basename $(SRCDIR)) +include ../common/Makefile + diff --git a/mod_limitipconn-0.23-httpd24.patch b/mod_limitipconn-0.23-httpd24.patch new file mode 100644 index 0000000..97f49f3 --- /dev/null +++ b/mod_limitipconn-0.23-httpd24.patch @@ -0,0 +1,65 @@ + +https://bugzilla.redhat.com/show_bug.cgi?id=809730 + +diff --git a/mod_limitipconn.c b/mod_limitipconn.c +index d8d2f9a..6262797 100644 +--- mod_limitipconn-0.23/mod_limitipconn.c.httpd24 ++++ mod_limitipconn-0.23/mod_limitipconn.c +@@ -104,7 +104,11 @@ static int check_limit(request_rec *r, l + return DECLINED; + } + ++#if AP_MODULE_MAGIC_AT_LEAST(20111130,0) ++ address = r->useragent_ip; ++#else + address = r->connection->remote_ip; ++#endif + + /* Only check the MIME-type if we have MIME-type stuff in our config. + The extra subreq can be quite expensive. */ +@@ -114,10 +118,12 @@ static int check_limit(request_rec *r, l + * translated into a MIME type. */ + content_type = ap_sub_req_lookup_uri(r->uri, r, NULL)->content_type; + ++#if !AP_MODULE_MAGIC_AT_LEAST(20090131, 0) + /* If there's no Content-type, use the default. */ + if (!content_type) { + content_type = ap_default_type(r); + } ++#endif + + ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, + "mod_limitipconn: uri: %s Content-Type: %s", +@@ -125,6 +131,9 @@ static int check_limit(request_rec *r, l + + /* Cycle through the exempt list; if our content_type is exempt, + * return OK */ ++#if AP_MODULE_MAGIC_AT_LEAST(20090131, 0) ++ if (content_type) ++#endif + for (i = 0; i < cfg->no_limit->nelts; i++) { + if ((ap_strcasecmp_match(content_type, nolim[i]) == 0) + || (strncmp(nolim[i], content_type, strlen(nolim[i])) == 0)) +@@ -139,6 +148,10 @@ static int check_limit(request_rec *r, l + * is not present, bail out */ + if (cfg->excl_limit->nelts) { + int excused = 1; ++ ++#if AP_MODULE_MAGIC_AT_LEAST(20090131, 0) ++ if (content_type) ++#endif + for (i = 0; i < cfg->excl_limit->nelts; i++) { + if ((ap_strcasecmp_match(content_type, exlim[i]) == 0) + || +@@ -160,7 +173,11 @@ static int check_limit(request_rec *r, l + * this IP address */ + for (i = 0; i < server_limit; ++i) { + for (j = 0; j < thread_limit; ++j) { ++#if AP_MODULE_MAGIC_AT_LEAST(20071023, 0) ++ ws_record = ap_get_scoreboard_worker_from_indexes(i, j); ++#else + ws_record = ap_get_scoreboard_worker(i, j); ++#endif + switch (ws_record->status) { + case SERVER_BUSY_READ: + case SERVER_BUSY_WRITE: diff --git a/mod_limitipconn.conf b/mod_limitipconn.conf new file mode 100644 index 0000000..545e9b2 --- /dev/null +++ b/mod_limitipconn.conf @@ -0,0 +1,15 @@ +# This module will not function unless mod_status is loaded and the +# "ExtendedStatus On" directive is set. So load only if mod_status is too. + + + # This is always needed + ExtendedStatus On + + # mod_limitipconn configuration + LoadModule limitipconn_module modules/mod_limitipconn.so + + # A global default configuration doesn't make much sense. See the README + # from the mod_limitipconn package for configuration examples. + + + diff --git a/mod_limitipconn.spec b/mod_limitipconn.spec new file mode 100644 index 0000000..34d1bc3 --- /dev/null +++ b/mod_limitipconn.spec @@ -0,0 +1,96 @@ +%{!?_httpd_apxs: %{expand: %%global _httpd_apxs %%{_sbindir}/apxs}} +%{!?_httpd_mmn: %{expand: %%global _httpd_mmn %%(cat %{_includedir}/httpd/.mmn || echo missing-httpd-devel)}} +%{!?_httpd_confdir: %{expand: %%global _httpd_confdir %%{_sysconfdir}/httpd/conf.d}} +# /etc/httpd/conf.d with httpd < 2.4 and defined as /etc/httpd/conf.modules.d with httpd >= 2.4 +%{!?_httpd_modconfdir: %{expand: %%global _httpd_modconfdir %%{_sysconfdir}/httpd/conf.d}} +%{!?_httpd_moddir: %{expand: %%global _httpd_moddir %%{_libdir}/httpd/modules}} + +Summary: Simultaneous connection limiting module for Apache +Name: mod_limitipconn +Version: 0.23 +Release: 9%{?dist} +Group: System Environment/Daemons +License: ASL 2.0 +URL: http://dominia.org/djao/limitipconn2.html +Source0: http://dominia.org/djao/limit/mod_limitipconn-%{version}.tar.bz2 +Source1: mod_limitipconn.conf +Patch0: mod_limitipconn-0.23-httpd24.patch +BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root +Requires: httpd-mmn = %{_httpd_mmn} +BuildRequires: httpd-devel + +%description +Apache module which allows web server administrators to limit the number of +simultaneous downloads permitted from a single IP address. + +%prep +%setup -q + +%patch0 -p1 -b .httpd24 + +%build +%{_httpd_apxs} -Wc,"%{optflags}" -c mod_limitipconn.c + + +%install +rm -rf %{buildroot} + +%if "%{_httpd_modconfdir}" == "%{_httpd_confdir}" +# httpd <= 2.2.x +install -D -p -m 0644 %{SOURCE1} \ + %{buildroot}%{_httpd_modconfdir}/limitipconn.conf +%else +# httpd >= 2.4.x +install -D -p -m 0644 %{SOURCE1} \ + %{buildroot}%{_httpd_modconfdir}/10-limitipconn.conf +%endif +install -D -p -m 0755 .libs/mod_limitipconn.so \ + %{buildroot}%{_httpd_moddir}/mod_limitipconn.so + + +%clean +rm -rf %{buildroot} + + +%files +%defattr(-,root,root,-) +%doc README INSTALL LICENSE +%config(noreplace) %{_httpd_modconfdir}/*.conf +%{_httpd_moddir}/mod_limitipconn.so + + +%changelog +* Thu Apr 19 2012 Remi Collet - 0.23-9 +- sync with rawhide, rebuild for remi repo + +* Thu Apr 19 2012 Joe Orton - 0.23-9 +- add _httpd_moddir compat macro as well (#809730) + +* Tue Apr 17 2012 Remi Collet - 0.23-8 +- rebuild for remi repo and httpd 2.4 + +* Tue Apr 17 2012 Joe Orton - 0.23-8 +- improve handling of absent content-type w/2.4 + +* Tue Apr 17 2012 Joe Orton - 0.23-7 +- update for 2.4 (patch from Jan Kaluza, #809730) + +* Thu Mar 29 2012 Matthias Saou 0.23-6 +- Rebuild for new apache httpd... not, we will require patching. +- Use rpm macros provided by the httpd-devel package, with sane fallbacks. + +* Fri Jan 13 2012 Fedora Release Engineering - 0.23-5 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild + +* Tue Feb 08 2011 Fedora Release Engineering - 0.23-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild + +* Sat Jul 25 2009 Fedora Release Engineering - 0.23-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild + +* Wed Feb 25 2009 Fedora Release Engineering - 0.23-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild + +* Mon Dec 1 2008 Matthias Saou 0.23-1 +- Initial RPM release. + -- cgit