--- libapache-mod-fastcgi-2.4.7~0910052141.orig/debian/copyright
+++ libapache-mod-fastcgi-2.4.7~0910052141/debian/copyright
@@ -5,6 +5,24 @@
 
 Copyright:
 
+ Copyright (c) 1995-1996 Open Market, Inc.
+
+Authors:
+
+ *  Patches for Apache-1.1 provided by
+    Ralf S. Engelschall
+    <rse@en.muc.de>
+ *  Patches for Linux provided by
+    Scott Langley
+    <langles@vote-smart.org>
+ *  Patches for suexec handling by
+    Brian Grossman <brian@SoftHome.net> and
+    Rob Saccoccio <robs@ipass.net>
+
+--------------------------------------------------------------------
+ mod_fastcgi license terms
+--------------------------------------------------------------------
+
 This FastCGI application library source and object code (the
 "Software") and its documentation (the "Documentation") are
 copyrighted by Open Market, Inc ("Open Market").  The following terms
--- libapache-mod-fastcgi-2.4.7~0910052141.orig/debian/fastcgi.load
+++ libapache-mod-fastcgi-2.4.7~0910052141/debian/fastcgi.load
@@ -0,0 +1 @@
+LoadModule fastcgi_module /usr/lib/apache2/modules/mod_fastcgi.so
--- libapache-mod-fastcgi-2.4.7~0910052141.orig/debian/control
+++ libapache-mod-fastcgi-2.4.7~0910052141/debian/control
@@ -1,18 +1,20 @@
 Source: libapache-mod-fastcgi
-Section: non-free/web
+Section: web
 Priority: optional
-Maintainer: Sam Vilain <sam@vilain.net>
-Standards-Version: 3.5.8.0
-Build-Depends: apache-dev (>= 1.3.0), debhelper (>> 3.0.0), lynx, libdb2-dev
+Maintainer: Tatsuki Sugiura <sugi@nemui.org>
+Standards-Version: 3.9.1
+Build-Depends: debhelper (>> 5.0.0), cdbs, dh-apache2, apache2-dev (>= 2.2.4), dpatch (>= 2.0.0), libtool, libapr1-dev, pkg-config
+Uploaders: Taku YASUI <tach@debian.or.jp>
+Homepage: http://www.fastcgi.com/
 
-Package: libapache-mod-fastcgi
+Package: libapache2-mod-fastcgi
 Architecture: any
-Depends: apache-common (>= 1.3.0), ${shlibs:Depends}
-Description: FastCGI module for Apache
- This package contains a FastCGI module for the Apache (1.3) web
- server.
- .
- FastCGI is an open standard for communicating between a web server
- and a web application, supported by many free and closed source web
- servers.  It provides CGI-like functionality, without the need to
- program to a particular server API.
+Depends: ${shlibs:Depends}, ${misc:Depends}
+Description: Apache 2 FastCGI module for long-running CGI scripts
+ This is a FastCGI module for the Apache 2.x web server.  FastCGI is an
+ open standard for communicating between a web server and a long-running
+ web application.  CGI scripts supporting FastCGI can be started as a
+ daemon and process multiple requests without restarting.  This is
+ particularly useful for scripts written in languages like Perl, as it
+ saves the cost of recompiling the scripts and its loaded modules with
+ each invocation.
--- libapache-mod-fastcgi-2.4.7~0910052141.orig/debian/libapache2-mod-fastcgi.README.Debian
+++ libapache-mod-fastcgi-2.4.7~0910052141/debian/libapache2-mod-fastcgi.README.Debian
@@ -0,0 +1,29 @@
+
+Config Tips
+----------------------
+
+ * How to run your FastCGI app
+
+   In case that FastCGI script has ".fcgi" suffix, you just put the script
+   in /usr/lib/cgi-bin (or other directory has "+ExecCGI") and can run it.
+
+ * Using non-".fcgi" suffix
+
+   If your app have non-".fcgi" suffix, add AddHandler/SetHandler to httpd.conf.
+   For exapmple;
+   ---
+     <Directory /var/www/myfcgiapp>
+       AddHandler fastcgi-script .yourext .pl .rb .cgi .sh
+     </Directory>
+   ---
+
+ * How to run under SuExec
+
+   make enable following line;
+     #FastCgiWrapper /usr/lib/apache2/suexec
+   in /etc/apache2/mods-enabled/fastcgi.conf
+
+ * If you change apache's uid
+
+   You need to change owner of /var/lib/apache*/fastcgi to uid of apache run.
+
--- libapache-mod-fastcgi-2.4.7~0910052141.orig/debian/libapache2-mod-fastcgi.postrm
+++ libapache-mod-fastcgi-2.4.7~0910052141/debian/libapache2-mod-fastcgi.postrm
@@ -0,0 +1,18 @@
+#! /bin/sh
+# postrm script for libapache-mod-fastcgi
+#
+# see: dh_installdeb(1)
+
+set -e
+
+fcgid_not_enabled () {
+	# no-op check in postrm
+	:
+}
+
+# dh_installdeb will replace this with shell code automatically
+# generated by other debhelper scripts.
+
+#DEBHELPER#
+
+exit 0
--- libapache-mod-fastcgi-2.4.7~0910052141.orig/debian/libapache2-mod-fastcgi.prerm
+++ libapache-mod-fastcgi-2.4.7~0910052141/debian/libapache2-mod-fastcgi.prerm
@@ -0,0 +1,18 @@
+#! /bin/sh
+# prerm script for libapache-mod-fastcgi
+#
+# see: dh_installdeb(1)
+
+set -e
+
+fcgid_not_enabled () {
+	# no-op check in prerm
+	:
+}
+
+# dh_installdeb will replace this with shell code automatically
+# generated by other debhelper scripts.
+
+#DEBHELPER#
+
+exit 0
--- libapache-mod-fastcgi-2.4.7~0910052141.orig/debian/libapache2-mod-fastcgi.docs
+++ libapache-mod-fastcgi-2.4.7~0910052141/debian/libapache2-mod-fastcgi.docs
@@ -0,0 +1 @@
+docs/mod_fastcgi.html
--- libapache-mod-fastcgi-2.4.7~0910052141.orig/debian/changelog
+++ libapache-mod-fastcgi-2.4.7~0910052141/debian/changelog
@@ -1,10 +1,113 @@
-libapache-mod-fastcgi (2.4.1) unstable; urgency=low
+libapache-mod-fastcgi (2.4.7~0910052141-1.1~wheezy) wheezy; urgency=low
 
-  * Debian builds adopted by upstream.  See the CHANGES file for a
-    list of changes since the last release.  Patches from the Debian
-    project most welcome :-)
+  * Backport to Wheezy
 
- -- Sam Vilain <sam@vilain.net>  Thu, 13 Nov 2003 02:00:37 +0000
+ -- Timothy Pearson <kb9vqf@pearsoncomputing.net>  Fri, 20 Jun 2014 17:03:00 -0600
+
+libapache-mod-fastcgi (2.4.7~0910052141-1.1) unstable; urgency=low
+
+  * Non-maintainer upload.
+  * Port to Apache 2.4 (closes: #666839).
+  * Drop some more vestiges of Apache 1 support.
+
+ -- Colin Watson <cjwatson@debian.org>  Thu, 11 Jul 2013 14:10:25 +0100
+
+libapache-mod-fastcgi (2.4.7~0910052141-1) unstable; urgency=low
+
+  * New upstream release
+
+ -- Tatsuki Sugiura <sugi@nemui.org>  Mon, 15 Nov 2010 16:31:58 +0900
+
+libapache-mod-fastcgi (2.4.6-1) unstable; urgency=low
+
+  * New upstream release
+
+ -- Tatsuki Sugiura <sugi@nemui.org>  Tue, 18 Mar 2008 11:23:42 +0900
+
+libapache-mod-fastcgi (2.4.2-10) unstable; urgency=low
+
+  * Drop apache1.3 module. (Closes: #429095)
+  * Now this cannot be built with apache2.0.
+
+ -- Tatsuki Sugiura <sugi@nemui.org>  Mon, 28 Jan 2008 15:17:58 +0900
+
+libapache-mod-fastcgi (2.4.2-9) unstable; urgency=low
+
+  * apply authn provider patch for apache2.2.
+    Thanks for Martin Furter (Closes: #414185)
+  * stop build apache 1.3 binary (Closes: #429095)
+  * fix suexec wrapper path (Closes: #415913)
+
+ -- Tatsuki Sugiura <sugi@nemui.org>  Sat, 25 Aug 2007 17:13:50 +0900
+
+libapache-mod-fastcgi (2.4.2-8) unstable; urgency=high
+
+  * transit libapache2-mod-fastcgi for apache2.2
+  * Fix in built-in suexec path (Closes: #331617)
+  * remove unnecessary libc6 version dependency (Closes: #343519)
+  * apply patch to fix that apache2 segv on load (Closes: #343514)
+
+ -- Tatsuki Sugiura <sugi@nemui.org>  Fri,  6 Oct 2006 20:53:21 +0900
+
+libapache-mod-fastcgi (2.4.2-7) unstable; urgency=low
+
+  * Update description. Thanks for Russ Allbery. (Closes: #320246)
+  * a2{en,dis}cmd automatically called in postinst/prerm. (Closes: #320246)
+
+ -- Tatsuki Sugiura <sugi@nemui.org>  Sat,  6 Aug 2005 14:18:30 +0900
+
+libapache-mod-fastcgi (2.4.2-6) unstable; urgency=low
+
+  * fix typo in original document (Closes: #288270)
+  * add config topic in README.Debian (Closes: #298819)
+
+ -- Tatsuki Sugiura <sugi@nemui.org>  Wed, 16 Mar 2005 22:27:02 +0900
+
+libapache-mod-fastcgi (2.4.2-5) unstable; urgency=high
+
+  * SuEXEC setting has been disabled in defualt. (Closes: #275201)
+
+ -- Tatsuki Sugiura <sugi@nemui.org>  Tue, 19 Oct 2004 13:38:17 +0900
+
+libapache-mod-fastcgi (2.4.2-4) unstable; urgency=low
+
+  * Add Documentation
+
+ -- Tatsuki Sugiura <sugi@nemui.org>  Wed,  8 Sep 2004 18:15:05 +0900
+
+libapache-mod-fastcgi (2.4.2-3) unstable; urgency=high
+
+  * Back out the ill-fated apache2 LFS transition.
+  * Bump the apache2-{threaded,prefork}-dev build-dep to (>= 2.0.50-10)
+
+ -- Tatsuki Sugiura <sugi@nemui.org>  Tue, 24 Aug 2004 22:44:11 +0900
+
+libapache-mod-fastcgi (2.4.2-2) unstable; urgency=medium
+
+  * rebuild for new ABI of apache2 2.0.50-9
+
+ -- Tatsuki Sugiura <sugi@nemui.org>  Tue, 17 Aug 2004 15:08:04 +0900
+
+libapache-mod-fastcgi (2.4.2-1) unstable; urgency=low
+
+  * Upstream Release.
+  * New Maintainer (Closes: #229214)
+
+ -- Tatsuki Sugiura <sugi@nemui.org>  Sat, 24 Jul 2004 06:07:47 +0900
+
+libapache-mod-fastcgi (2.4.0-4) unstable; urgency=low
+
+  * QA upload.
+  * libdb4.1-dev build-dependency removed. (Closes: #243017)
+  * Standards-Version updated.
+
+ -- Emanuele Rocca <ema@debian.org>  Tue, 13 Apr 2004 18:09:33 +0200
+
+libapache-mod-fastcgi (2.4.0-3) unstable; urgency=low
+
+  * Orphaned.
+
+ -- Davide Puricelli (evo) <evo@debian.org>  Fri, 23 Jan 2004 19:15:54 +0100
 
 libapache-mod-fastcgi (2.4.0-2) unstable; urgency=low
 
--- libapache-mod-fastcgi-2.4.7~0910052141.orig/debian/libapache2-mod-fastcgi.postinst
+++ libapache-mod-fastcgi-2.4.7~0910052141/debian/libapache2-mod-fastcgi.postinst
@@ -0,0 +1,17 @@
+#! /bin/sh
+# postinst script for libapache-mod-fastcgi
+#
+# see: dh_installdeb(1)
+
+set -e
+
+fcgid_not_enabled () {
+	! a2query -q -m fcgid
+}
+
+# dh_installdeb will replace this with shell code automatically
+# generated by other debhelper scripts.
+
+#DEBHELPER#
+
+exit 0
--- libapache-mod-fastcgi-2.4.7~0910052141.orig/debian/README.source
+++ libapache-mod-fastcgi-2.4.7~0910052141/debian/README.source
@@ -0,0 +1,35 @@
+This package uses CDBS (and therefore simple-patchsys.mk) in order to 
+apply patches to the upstream source. Patches are stored in 
+debian/patches and their filenames usually end in .patch or .diff .
+For further details, see the man page for cdbs-edit-patch.
+
+All commands described below should be run from the top directory of the 
+package source tree, unless otherwise stated.
+
+ * To generate the fully patched source, in a form ready for
+   editing, that would be built to create Debian packages, run: 
+
+     make -f debian/rules apply-patches
+
+   Note: It has been proposed that, in future, this should happen 
+   automatically when you run dpkg-source -x on a CDBS 
+   simple-patchsys.mk source package.  However, this proposal has 
+   apparently not yet been implemented, so for now you have to do 
+   it yourself like this.
+
+ * To modify the source and save those modifications so that
+   they will be applied when building the package, pick a
+   suitably informative patch file name, for example
+   01_add_README.source_file.patch, and then run:
+
+     cdbs-edit-patch 01_add_README.source_file.patch
+
+   This will place you in a new shell in a temporary copy of the 
+   source tree.  Make your desired modifications to it, and then 
+   exit the shell to create the patch file containing them (this 
+   file will appear in debian/patches).
+
+ * To remove source modifications that are currently being
+   applied when building the package, run:
+
+     make -f debian/rules reverse-patches
--- libapache-mod-fastcgi-2.4.7~0910052141.orig/debian/libapache2-mod-fastcgi.apache2
+++ libapache-mod-fastcgi-2.4.7~0910052141/debian/libapache2-mod-fastcgi.apache2
@@ -0,0 +1,3 @@
+mod build-tmp/20/.libs/mod_fastcgi.so
+mod debian/fastcgi.load
+mod debian/fastcgi.conf
--- libapache-mod-fastcgi-2.4.7~0910052141.orig/debian/fastcgi.conf
+++ libapache-mod-fastcgi-2.4.7~0910052141/debian/fastcgi.conf
@@ -0,0 +1,5 @@
+<IfModule mod_fastcgi.c>
+  AddHandler fastcgi-script .fcgi
+  #FastCgiWrapper /usr/lib/apache2/suexec
+  FastCgiIpcDir /var/lib/apache2/fastcgi
+</IfModule>
--- libapache-mod-fastcgi-2.4.7~0910052141.orig/debian/watch
+++ libapache-mod-fastcgi-2.4.7~0910052141/debian/watch
@@ -0,0 +1,5 @@
+version=2
+
+http://www.fastcgi.com/dist/ \
+	mod_fastcgi-([\d.]+)\.tar\.gz \
+	debian uupdate
--- libapache-mod-fastcgi-2.4.7~0910052141.orig/debian/rules
+++ libapache-mod-fastcgi-2.4.7~0910052141/debian/rules
@@ -1,50 +1,31 @@
 #!/usr/bin/make -f
-CFLAGS = -O2 -Wall
-ifneq (,$(findstring debug,$(DEB_BUILD_OPTIONS)))
-CFLAGS += -g
-endif
-ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
-INSTALL_PROGRAM += -s
-endif
-
-binary: binary-indep binary-arch
-
-binary-indep:
-
-binary-arch: build install
-	dh_testdir
-	dh_testroot
-	#dh_installchangelogs CHANGES
-	dh_installdocs docs/mod_fastcgi.html CHANGES
-	dh_installdeb
-	dh_fixperms
-	dh_shlibdeps
-	dh_compress
-ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
-	dh_strip
-endif
-	dh_md5sums
-	dh_gencontrol
-	dh_builddeb
-
-build: build-stamp
-build-stamp:
-	dh_testdir
-	CFLAGS="$(CFLAGS)" /usr/bin/apxs -o mod_fastcgi.so -c *.c
-	touch build-stamp
-	
-clean:
-	dh_testdir
-	rm -f build-stamp
-	-rm -f *.o mod_fastcgi.so			
-	dh_clean build-stamp
-
-install:
-	dh_testdir
-	dh_installdirs
-	mkdir -p debian/tmp/usr/lib/apache/1.3
-	cp mod_fastcgi.so debian/tmp/usr/lib/apache/1.3/
-	chmod 644 debian/tmp/usr/lib/apache/1.3/mod_fastcgi.so
-	cp debian/500mod_fastcgi.info debian/tmp/usr/lib/apache/1.3/		
-	
-.PHONY: binary binary-arch binary-indep clean build install 
+
+include /usr/share/cdbs/1/rules/debhelper.mk
+include /usr/share/cdbs/1/class/langcore.mk
+include /usr/share/cdbs/1/class/makefile-vars.mk
+include /usr/share/cdbs/1/rules/dpatch.mk
+
+APACHE2_VERSION=`dpkg -s apache2-prefork-dev apache2-threaded-dev 2>/dev/null |grep Version: | awk '{print $$2}'`
+
+DEB_BUILDDIR = $(CURDIR)/build-tmp
+DEB_BUILDDIR_libapache2-mod-fastcgi = $(DEB_BUILDDIR)/20
+DEB_DESTDIR_libapache2-mod-fastcgi = $(CURDIR)/debian/libapache2-mod-fastcgi
+DEB_FIXPERMS_EXCLUDE = var/lib/apache2/fastcgi var/lib/apache/fastcgi
+
+AP2_MAKE_DEFS = top_dir=/usr/share/apache2 \
+	APXS=apxs2 APACHECTL=apachectl2 \
+	LIBTOOL="libtool --tag=CC" SH_LIBTOOL="libtool --tag=CC" \
+	INCLUDES="-I/usr/include/apache2 `pkg-config --cflags apr-1`"
+
+configure/libapache2-mod-fastcgi::
+	cp -a *.c *.h *.mk .deps $(DEB_BUILDDIR_$(cdbs_curpkg))
+	cp -a Makefile.AP2 $(DEB_BUILDDIR_$(cdbs_curpkg))
+
+build/libapache2-mod-fastcgi::
+	$(DEB_MAKE_INVOKE) -C $(DEB_BUILDDIR_$(cdbs_curpkg)) $(AP2_MAKE_DEFS) -f Makefile.AP2
+
+install/libapache2-mod-fastcgi::
+	dh_apache2 --conditional=fcgid_not_enabled
+	mkdir -p $(DEB_DESTDIR_$(cdbs_curpkg))/var/lib/apache2/fastcgi
+	chown www-data:www-data $(DEB_DESTDIR_$(cdbs_curpkg))/var/lib/apache2/fastcgi
+	chmod 755 $(DEB_DESTDIR_$(cdbs_curpkg))/var/lib/apache2/fastcgi
--- libapache-mod-fastcgi-2.4.7~0910052141.orig/debian/patches/00list
+++ libapache-mod-fastcgi-2.4.7~0910052141/debian/patches/00list
@@ -0,0 +1,5 @@
+#apache2-segv-on-load.dpatch # fixed
+#apache2.2-authn.dpatch # fixed
+#apache2.2-compat.dpatch # fixed
+doc-misc-typo-fix.dpatch
+apache2.4-compat.dpatch
--- libapache-mod-fastcgi-2.4.7~0910052141.orig/debian/patches/apache2.4-compat.dpatch
+++ libapache-mod-fastcgi-2.4.7~0910052141/debian/patches/apache2.4-compat.dpatch
@@ -0,0 +1,118 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## apache2.4-compat.dpatch by Colin Watson <cjwatson@ubuntu.com>
+##
+## All lines beginning with `## DP:' are a description of the patch.
+## DP: Make compatible with Apache 2.4.
+
+@DPATCH@
+diff -urNad '--exclude=CVS' '--exclude=.svn' '--exclude=.git' '--exclude=.arch' '--exclude=.hg' '--exclude=_darcs' '--exclude=.bzr' libapache-mod-fastcgi-2.4.7~0910052141~/fcgi.h libapache-mod-fastcgi-2.4.7~0910052141/fcgi.h
+--- libapache-mod-fastcgi-2.4.7~0910052141~/fcgi.h	2008-09-22 11:36:06.000000000 +0100
++++ libapache-mod-fastcgi-2.4.7~0910052141/fcgi.h	2013-07-11 14:03:48.000000000 +0100
+@@ -57,10 +57,14 @@
+ #define XtOffsetOf APR_OFFSETOF
+ #define ap_select select
+ 
+-#define ap_user_id        unixd_config.user_id
+-#define ap_group_id       unixd_config.group_id
+-#define ap_user_name      unixd_config.user_name
+-#define ap_suexec_enabled unixd_config.suexec_enabled
++#if MODULE_MAGIC_NUMBER < 20081212
++#define ap_unixd_config unixd_config
++#endif
++
++#define ap_user_id        ap_unixd_config.user_id
++#define ap_group_id       ap_unixd_config.group_id
++#define ap_user_name      ap_unixd_config.user_name
++#define ap_suexec_enabled ap_unixd_config.suexec_enabled
+ 
+ #ifndef S_ISDIR
+ #define S_ISDIR(m)      (((m)&(S_IFMT)) == (S_IFDIR))
+@@ -354,42 +358,42 @@
+ #ifdef APACHE2
+ 
+ #ifdef WIN32
+-#define FCGI_LOG_EMERG          __FILE__,__LINE__,APLOG_EMERG,APR_FROM_OS_ERROR(GetLastError())
+-#define FCGI_LOG_ALERT          __FILE__,__LINE__,APLOG_ALERT,APR_FROM_OS_ERROR(GetLastError())
+-#define FCGI_LOG_CRIT           __FILE__,__LINE__,APLOG_CRIT,APR_FROM_OS_ERROR(GetLastError())
+-#define FCGI_LOG_ERR            __FILE__,__LINE__,APLOG_ERR,APR_FROM_OS_ERROR(GetLastError())
+-#define FCGI_LOG_WARN           __FILE__,__LINE__,APLOG_WARNING,APR_FROM_OS_ERROR(GetLastError())
+-#define FCGI_LOG_NOTICE         __FILE__,__LINE__,APLOG_NOTICE,APR_FROM_OS_ERROR(GetLastError())
+-#define FCGI_LOG_INFO           __FILE__,__LINE__,APLOG_INFO,APR_FROM_OS_ERROR(GetLastError())
+-#define FCGI_LOG_DEBUG          __FILE__,__LINE__,APLOG_DEBUG,APR_FROM_OS_ERROR(GetLastError())
++#define FCGI_LOG_EMERG          APLOG_MARK,APLOG_EMERG,APR_FROM_OS_ERROR(GetLastError())
++#define FCGI_LOG_ALERT          APLOG_MARK,APLOG_ALERT,APR_FROM_OS_ERROR(GetLastError())
++#define FCGI_LOG_CRIT           APLOG_MARK,APLOG_CRIT,APR_FROM_OS_ERROR(GetLastError())
++#define FCGI_LOG_ERR            APLOG_MARK,APLOG_ERR,APR_FROM_OS_ERROR(GetLastError())
++#define FCGI_LOG_WARN           APLOG_MARK,APLOG_WARNING,APR_FROM_OS_ERROR(GetLastError())
++#define FCGI_LOG_NOTICE         APLOG_MARK,APLOG_NOTICE,APR_FROM_OS_ERROR(GetLastError())
++#define FCGI_LOG_INFO           APLOG_MARK,APLOG_INFO,APR_FROM_OS_ERROR(GetLastError())
++#define FCGI_LOG_DEBUG          APLOG_MARK,APLOG_DEBUG,APR_FROM_OS_ERROR(GetLastError())
+ #else /* !WIN32 */
+-#define FCGI_LOG_EMERG          __FILE__,__LINE__,APLOG_EMERG,APR_FROM_OS_ERROR(errno)
+-#define FCGI_LOG_ALERT          __FILE__,__LINE__,APLOG_ALERT,APR_FROM_OS_ERROR(errno)
+-#define FCGI_LOG_CRIT           __FILE__,__LINE__,APLOG_CRIT,APR_FROM_OS_ERROR(errno)
+-#define FCGI_LOG_ERR            __FILE__,__LINE__,APLOG_ERR,APR_FROM_OS_ERROR(errno)
+-#define FCGI_LOG_WARN           __FILE__,__LINE__,APLOG_WARNING,APR_FROM_OS_ERROR(errno)
+-#define FCGI_LOG_NOTICE         __FILE__,__LINE__,APLOG_NOTICE,APR_FROM_OS_ERROR(errno)
+-#define FCGI_LOG_INFO           __FILE__,__LINE__,APLOG_INFO,APR_FROM_OS_ERROR(errno)
+-#define FCGI_LOG_DEBUG          __FILE__,__LINE__,APLOG_DEBUG,APR_FROM_OS_ERROR(errno)
++#define FCGI_LOG_EMERG          APLOG_MARK,APLOG_EMERG,APR_FROM_OS_ERROR(errno)
++#define FCGI_LOG_ALERT          APLOG_MARK,APLOG_ALERT,APR_FROM_OS_ERROR(errno)
++#define FCGI_LOG_CRIT           APLOG_MARK,APLOG_CRIT,APR_FROM_OS_ERROR(errno)
++#define FCGI_LOG_ERR            APLOG_MARK,APLOG_ERR,APR_FROM_OS_ERROR(errno)
++#define FCGI_LOG_WARN           APLOG_MARK,APLOG_WARNING,APR_FROM_OS_ERROR(errno)
++#define FCGI_LOG_NOTICE         APLOG_MARK,APLOG_NOTICE,APR_FROM_OS_ERROR(errno)
++#define FCGI_LOG_INFO           APLOG_MARK,APLOG_INFO,APR_FROM_OS_ERROR(errno)
++#define FCGI_LOG_DEBUG          APLOG_MARK,APLOG_DEBUG,APR_FROM_OS_ERROR(errno)
+ #endif
+ 
+-#define FCGI_LOG_EMERG_ERRNO    __FILE__,__LINE__,APLOG_EMERG,APR_FROM_OS_ERROR(errno)
+-#define FCGI_LOG_ALERT_ERRNO    __FILE__,__LINE__,APLOG_ALERT,APR_FROM_OS_ERROR(errno)
+-#define FCGI_LOG_CRIT_ERRNO     __FILE__,__LINE__,APLOG_CRIT,APR_FROM_OS_ERROR(errno)
+-#define FCGI_LOG_ERR_ERRNO      __FILE__,__LINE__,APLOG_ERR,APR_FROM_OS_ERROR(errno)
+-#define FCGI_LOG_WARN_ERRNO     __FILE__,__LINE__,APLOG_WARNING,APR_FROM_OS_ERROR(errno)
+-#define FCGI_LOG_NOTICE_ERRNO   __FILE__,__LINE__,APLOG_NOTICE,APR_FROM_OS_ERROR(errno)
+-#define FCGI_LOG_INFO_ERRNO     __FILE__,__LINE__,APLOG_INFO,APR_FROM_OS_ERROR(errno)
+-#define FCGI_LOG_DEBUG_ERRNO    __FILE__,__LINE__,APLOG_DEBUG,APR_FROM_OS_ERROR(errno)
++#define FCGI_LOG_EMERG_ERRNO    APLOG_MARK,APLOG_EMERG,APR_FROM_OS_ERROR(errno)
++#define FCGI_LOG_ALERT_ERRNO    APLOG_MARK,APLOG_ALERT,APR_FROM_OS_ERROR(errno)
++#define FCGI_LOG_CRIT_ERRNO     APLOG_MARK,APLOG_CRIT,APR_FROM_OS_ERROR(errno)
++#define FCGI_LOG_ERR_ERRNO      APLOG_MARK,APLOG_ERR,APR_FROM_OS_ERROR(errno)
++#define FCGI_LOG_WARN_ERRNO     APLOG_MARK,APLOG_WARNING,APR_FROM_OS_ERROR(errno)
++#define FCGI_LOG_NOTICE_ERRNO   APLOG_MARK,APLOG_NOTICE,APR_FROM_OS_ERROR(errno)
++#define FCGI_LOG_INFO_ERRNO     APLOG_MARK,APLOG_INFO,APR_FROM_OS_ERROR(errno)
++#define FCGI_LOG_DEBUG_ERRNO    APLOG_MARK,APLOG_DEBUG,APR_FROM_OS_ERROR(errno)
+ 
+-#define FCGI_LOG_EMERG_NOERRNO    __FILE__,__LINE__,APLOG_EMERG,0
+-#define FCGI_LOG_ALERT_NOERRNO    __FILE__,__LINE__,APLOG_ALERT,0
+-#define FCGI_LOG_CRIT_NOERRNO     __FILE__,__LINE__,APLOG_CRIT,0
+-#define FCGI_LOG_ERR_NOERRNO      __FILE__,__LINE__,APLOG_ERR,0
+-#define FCGI_LOG_WARN_NOERRNO     __FILE__,__LINE__,APLOG_WARNING,0
+-#define FCGI_LOG_NOTICE_NOERRNO   __FILE__,__LINE__,APLOG_NOTICE,0
+-#define FCGI_LOG_INFO_NOERRNO     __FILE__,__LINE__,APLOG_INFO,0
+-#define FCGI_LOG_DEBUG_NOERRNO    __FILE__,__LINE__,APLOG_DEBUG,0
++#define FCGI_LOG_EMERG_NOERRNO    APLOG_MARK,APLOG_EMERG,0
++#define FCGI_LOG_ALERT_NOERRNO    APLOG_MARK,APLOG_ALERT,0
++#define FCGI_LOG_CRIT_NOERRNO     APLOG_MARK,APLOG_CRIT,0
++#define FCGI_LOG_ERR_NOERRNO      APLOG_MARK,APLOG_ERR,0
++#define FCGI_LOG_WARN_NOERRNO     APLOG_MARK,APLOG_WARNING,0
++#define FCGI_LOG_NOTICE_NOERRNO   APLOG_MARK,APLOG_NOTICE,0
++#define FCGI_LOG_INFO_NOERRNO     APLOG_MARK,APLOG_INFO,0
++#define FCGI_LOG_DEBUG_NOERRNO    APLOG_MARK,APLOG_DEBUG,0
+ 
+ #else /* !APACHE2 */
+ 
+diff -urNad '--exclude=CVS' '--exclude=.svn' '--exclude=.git' '--exclude=.arch' '--exclude=.hg' '--exclude=_darcs' '--exclude=.bzr' libapache-mod-fastcgi-2.4.7~0910052141~/mod_fastcgi.c libapache-mod-fastcgi-2.4.7~0910052141/mod_fastcgi.c
+--- libapache-mod-fastcgi-2.4.7~0910052141~/mod_fastcgi.c	2008-11-09 14:31:03.000000000 +0000
++++ libapache-mod-fastcgi-2.4.7~0910052141/mod_fastcgi.c	2013-07-11 14:04:08.842780018 +0100
+@@ -153,6 +153,10 @@
+ u_int dynamic_idle_timeout = FCGI_DEFAULT_IDLE_TIMEOUT;
+ int dynamicMinServerLife = FCGI_DEFAULT_MIN_SERVER_LIFE;
+ 
++#ifdef APLOG_USE_MODULE
++APLOG_USE_MODULE(fastcgi);
++#endif
++
+ /*******************************************************************************
+  * Construct a message and write it to the pm_pipe.
+  */
--- libapache-mod-fastcgi-2.4.7~0910052141.orig/debian/patches/apache2-segv-on-load.dpatch
+++ libapache-mod-fastcgi-2.4.7~0910052141/debian/patches/apache2-segv-on-load.dpatch
@@ -0,0 +1,30 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## apache2-segv-on-load.dpatch by  <sugi@nemui.org>
+##
+## All lines beginning with `## DP:' are a description of the patch.
+## DP: See the URL for details.
+## DP: http://www.fastcgi.com/archives/fastcgi-developers/2005-April/003673.html
+
+@DPATCH@
+diff -urNad libapache-mod-fastcgi~/mod_fastcgi.c libapache-mod-fastcgi/mod_fastcgi.c
+--- libapache-mod-fastcgi~/mod_fastcgi.c	2005-08-06 14:09:11.000000000 +0900
++++ libapache-mod-fastcgi/mod_fastcgi.c	2006-10-06 20:52:46.368480801 +0900
+@@ -2850,10 +2850,15 @@
+ 
+     get_request_identity(r, &uid, &gid);
+ 
+-    if (fcgi_util_fs_get_by_id(r->filename, uid, gid))
++    /* Only try this if r->filename is not NULL,
++     * otherwise Apache 2 crashes with SIGSEGV... */
++    if (r->filename)
+     {
+-        r->handler = FASTCGI_HANDLER_NAME;
+-        return OK;
++        if (fcgi_util_fs_get_by_id(r->filename, uid, gid))
++        {
++            r->handler = FASTCGI_HANDLER_NAME;
++            return OK;
++        }
+     }
+ 
+     return DECLINED;
--- libapache-mod-fastcgi-2.4.7~0910052141.orig/debian/patches/doc-misc-typo-fix.dpatch
+++ libapache-mod-fastcgi-2.4.7~0910052141/debian/patches/doc-misc-typo-fix.dpatch
@@ -0,0 +1,19 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## by Troestler Christophe <Christophe.Troestler@umh.ac.be>
+##
+## All lines beginning with `## DP:' are a description of the patch.
+## DP: fix for document dead link 
+## DP: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=288270
+
+@DPATCH@
+--- libapache-mod-fastcgi-2.4.6.orig/docs/mod_fastcgi.html
++++ libapache-mod-fastcgi-2.4.6/docs/mod_fastcgi.html
+@@ -67,7 +67,7 @@
+         </P>
+         <P>
+             FastCGI applications under <CODE>mod_fastcgi</CODE> are defined as one of three types: static, dynamic, or
+-            external. They&#39;re configured using the <A HREF="#fastcgiserver">FastCgiServer</A>, <A HREF=
++            external. They&#39;re configured using the <A HREF="#FastCgiServer">FastCgiServer</A>, <A HREF=
+             "#FastCgiConfig">FastCgiConfig</A>, and <A HREF="#FastCgiExternalServer">FastCgiExternalServer</A> <A HREF=
+             "#directives">directives</A> respectively. Any URI that Apache identifies as a FastCGI application and
+             which hasn&#39;t been explicitly configured using a <A HREF="#fastcgiserver">FastCgiServer</A> or <A HREF=
--- libapache-mod-fastcgi-2.4.7~0910052141.orig/debian/patches/apache2.2-compat.dpatch
+++ libapache-mod-fastcgi-2.4.7~0910052141/debian/patches/apache2.2-compat.dpatch
@@ -0,0 +1,60 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## apache2.2-compat.dpatch by daniel.smertnig at gmail.com
+##
+## All lines beginning with `## DP:' are a description of the patch.
+## DP: compat for Apache 2.2
+## downlowded from: http://www.fastcgi.com/archives/fastcgi-developers/2005-December/004060.html
+##
+
+@DPATCH@
+diff -ruN mod_fastcgi-2.4.2/fcgi.h mod_fastcgi-2.4.2-ap22/fcgi.h
+--- mod_fastcgi-2.4.2/fcgi.h	2003-02-04 00:07:37.000000000 +0100
++++ mod_fastcgi-2.4.2-ap22/fcgi.h	2005-12-07 21:05:55.000000000 +0100
+@@ -73,6 +73,36 @@
+ #define ap_reset_timeout(a)
+ #define ap_unblock_alarms()
+ 
++/* starting with apache 2.2 the backward-compatibility defines for
++ * 1.3 APIs are not available anymore. Define them ourselves here.
++ */
++#ifndef ap_copy_table
++
++#define ap_copy_table apr_table_copy
++#define ap_cpystrn apr_cpystrn
++#define ap_destroy_pool apr_pool_destroy
++#define ap_isspace apr_isspace
++#define ap_make_array apr_array_make
++#define ap_make_table apr_table_make
++#define ap_null_cleanup apr_pool_cleanup_null 
++#define ap_palloc apr_palloc
++#define ap_pcalloc apr_pcalloc
++#define ap_psprintf apr_psprintf
++#define ap_pstrcat apr_pstrcat
++#define ap_pstrdup apr_pstrdup
++#define ap_pstrndup apr_pstrndup
++#define ap_push_array apr_array_push
++#define ap_register_cleanup apr_pool_cleanup_register
++#define ap_snprintf apr_snprintf
++#define ap_table_add apr_table_add
++#define ap_table_do apr_table_do
++#define ap_table_get apr_table_get
++#define ap_table_set apr_table_set
++#define ap_table_setn apr_table_setn
++#define ap_table_unset apr_table_unset
++
++#endif /* defined(ap_copy_table) */
++
+ #if (defined(HAVE_WRITEV) && !HAVE_WRITEV && !defined(NO_WRITEV)) || defined WIN32
+ #define NO_WRITEV
+ #endif
+diff -ruN mod_fastcgi-2.4.2/Makefile.AP2 mod_fastcgi-2.4.2-ap22/Makefile.AP2
+--- mod_fastcgi-2.4.2/Makefile.AP2	2002-07-29 03:36:34.000000000 +0200
++++ mod_fastcgi-2.4.2-ap22/Makefile.AP2	2005-12-07 20:27:50.000000000 +0100
+@@ -20,8 +20,6 @@
+ 
+ all: local-shared-build
+ 
+-install: install-modules
+-
+ clean:
+ 	-rm -f *.o *.lo *.slo *.la 
--- libapache-mod-fastcgi-2.4.7~0910052141.orig/debian/patches/apache2.2-authn.dpatch
+++ libapache-mod-fastcgi-2.4.7~0910052141/debian/patches/apache2.2-authn.dpatch
@@ -0,0 +1,114 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## apache2.2-authn.dpatch by  <sugi@nemui.org>
+##
+## All lines beginning with `## DP:' are a description of the patch.
+## DP: mod_fastcgi works as AUTHN provider for apache 2.2
+## 
+
+@DPATCH@
+diff -urNad libapache-mod-fastcgi~/mod_fastcgi.c libapache-mod-fastcgi/mod_fastcgi.c
+--- libapache-mod-fastcgi~/mod_fastcgi.c	2006-10-06 21:55:39.000000000 +0900
++++ libapache-mod-fastcgi/mod_fastcgi.c	2007-08-25 16:51:25.000000000 +0900
+@@ -82,6 +82,10 @@
+ 
+ #include "unixd.h"
+ 
++#ifdef APACHE22
++#include "mod_auth.h"
++#endif
++
+ #endif
+ #endif
+ 
+@@ -2657,10 +2661,15 @@
+     r->status_line = NULL;
+ }
+ 
++#ifdef APACHE22
++static authn_status check_user_authentication(request_rec *r, const char *user, const char *password)
++{
++#else /* !APACHE22 */
+ static int check_user_authentication(request_rec *r)
+ {
+-    int res, authenticated = 0;
+     const char *password;
++#endif
++    int res, authenticated = 0;
+     fcgi_request *fr;
+     const fcgi_dir_config * const dir_config =
+         (const fcgi_dir_config *)ap_get_module_config(r->per_dir_config, &fastcgi_module);
+@@ -2668,9 +2677,11 @@
+     if (dir_config->authenticator == NULL)
+         return DECLINED;
+ 
+-    /* Get the user password */
++#ifndef APACHE22
++		/* Get the user password */
+     if ((res = ap_get_basic_auth_pw(r, &password)) != OK)
+         return res;
++#endif /* APACHE22 */
+ 
+     res = create_fcgi_request(r, dir_config->authenticator, &fr);
+     if (res)
+@@ -2704,6 +2715,20 @@
+         goto AuthenticationFailed;
+     }
+ 
++#ifdef APACHE22
++    if (authenticated)
++        return AUTH_GRANTED;
++
++AuthenticationFailed:
++    /* @@@ Probably should support custom_responses */
++    ap_note_basic_auth_failure(r);
++    ap_log_rerror(FCGI_LOG_ERR_NOERRNO, r,
++        "FastCGI: authentication failed for user \"%s\": %s",
++        r->user, r->uri);
++
++		return (res == OK) ? AUTH_DENIED : AUTH_GRANTED;
++
++#else /* !APACHE22 */
+     if (authenticated)
+         return OK;
+ 
+@@ -2722,6 +2747,7 @@
+ #endif
+ 
+         return (res == OK) ? HTTP_UNAUTHORIZED : res;
++#endif /* !APACHE22 */
+ }
+ 
+ static int check_user_authorization(request_rec *r)
+@@ -2913,16 +2939,31 @@
+ 
+ #ifdef APACHE2
+ 
++#ifdef APACHE22
++static const authn_provider authn_fastcgi_provider =
++{
++    &check_user_authentication,
++		NULL,
++};
++#endif /* APACHE22 */
++
++
+ static void register_hooks(apr_pool_t * p)
+ {
+     /* ap_hook_pre_config(x_pre_config, NULL, NULL, APR_HOOK_MIDDLE); */
+     ap_hook_post_config(init_module, NULL, NULL, APR_HOOK_MIDDLE);
+     ap_hook_child_init(fcgi_child_init, NULL, NULL, APR_HOOK_MIDDLE);
+     ap_hook_handler(content_handler, NULL, NULL, APR_HOOK_MIDDLE);
+-    ap_hook_check_user_id(check_user_authentication, NULL, NULL, APR_HOOK_MIDDLE);
+     ap_hook_access_checker(check_access, NULL, NULL, APR_HOOK_MIDDLE);
+     ap_hook_auth_checker(check_user_authorization, NULL, NULL, APR_HOOK_MIDDLE);
+     ap_hook_fixups(fixups, NULL, NULL, APR_HOOK_MIDDLE); 
++#ifdef APACHE22
++		ap_register_provider(p, AUTHN_PROVIDER_GROUP, "fastcgi", "0",
++			 &authn_fastcgi_provider);
++#else
++    ap_hook_check_user_id(check_user_authentication, NULL, NULL, APR_HOOK_MIDDLE);
++#endif
++
+ }
+ 
+ module AP_MODULE_DECLARE_DATA fastcgi_module =