proxytunnel for Debian
----------------------

Debian has a patch to handle buggy apache installations in the form of
the -B/--buggy-encrypt-proxy patch, due to Jim Paris <jim@jtan.com>.
Users have had mixed success with this, though.

The alternative, if it is possible, is to patch the Apache 2.2
installation.  (Apache 2.4 has had this patch applied upstream.)  This
will need to be done for every release of Apache 2.2.  It can be done
as follows, assuming that you have the devscripts package installed.

1. Download the apache2 source (here, "$ " indicates the shell prompt):
   $ cd /tmp
   $ apt-get source apache2

2. Ensure that you have the required build dependencies installed:
   [as root:]
   # aptitude build-depends apache2
   [or: apt-get build-dep apache2]

3. Enter the apache directory and apply the patch:
   $ cd apache2-2.2.22
     # you may have to replace 2.2.22 with 2.2.xx if an updated 2.2
     # version is released
   $ export QUILT_PATCHES=debian/patches
   $ quilt new 999_mod_proxy
   $ quilt add modules/proxy/mod_proxy_connect.c
   $ patch -p1 < /usr/share/doc/proxytunnel/mod-proxy.patch
   $ quilt refresh
     # ignore the "trailing whitespace" warning
   $ dch --nmu 'Apply mod-proxy patch'
     # this last command assumes that you have the devscripts package
     # installed

4. Build the package:
   $ debuild -us -uc

5. Now install the package.  My method is as follows.  First run:
   $ dpkg -l | grep 2.2.22
   This will list all of the currently installed Apache packages (and
   possibly some non-apache ones too), for example:

ii  apache2                                         2.2.22-6
   Apache HTTP Server metapackage
ii  apache2-doc                                     2.2.22-6
   Apache HTTP Server documentation
[...]

   Now as root, do the following:

   # cd /tmp
   # dpkg -i apache2_2.2.22-6.1_amd64.deb apache2-doc_2.2.22-6.1_all.deb ...

   where the packages listed on the dpkg -i line correspond to those
   you already have installed.

That's it!

 -- Julian Gilbey <jdg@debian.org>  Sun, 10 Jun 2012
