From 307d9bf70dec6e98cf0403b95ead326611ad2f37 Mon Sep 17 00:00:00 2001
From: Roland Rosenfeld <roland@spinnaker.de>
Date: Mon, 29 Aug 2016 12:04:09 +0000
Subject: [PATCH] Add all Debian changes since 3.0.24-2.

---
 debian/README.Debian                       | 17 ----
 debian/changelog                           | 94 +++++++++++++++++-----
 debian/config                              | 25 ++++++
 debian/control                             |  8 +-
 debian/copyright                           | 75 +++++++++++++++--
 debian/dirs                                |  1 +
 debian/patches/05_defaut_action.patch      |  4 +-
 debian/patches/14_config.patch             | 11 +--
 debian/patches/25_standard_medium.patch    |  4 +-
 debian/patches/27_remove_nsl.patch         |  2 +-
 debian/patches/28_listen_localhost.patch   | 17 ----
 debian/patches/33_manpage_hyphen.patch     |  2 +-
 debian/patches/34_system-docbook2man.patch |  2 +-
 debian/patches/35_man-spelling.patch       | 14 ++++
 debian/patches/series                      |  2 +-
 debian/po/POTFILES.in                      |  1 +
 debian/po/de.po                            | 32 ++++++++
 debian/po/fr.po                            | 34 ++++++++
 debian/po/nl.po                            | 36 +++++++++
 debian/po/pt_BR.po                         | 34 ++++++++
 debian/po/sv.po                            | 32 ++++++++
 debian/po/templates.pot                    | 32 ++++++++
 debian/postinst                            | 25 ++++++
 debian/postrm                              | 10 +++
 debian/privoxy.service                     |  2 +
 debian/rules                               | 14 +++-
 debian/templates                           |  6 ++
 debian/tests/control                       |  2 +
 debian/tests/privoxy-regression-test       | 44 ++++++++++
 29 files changed, 500 insertions(+), 82 deletions(-)
 create mode 100755 debian/config
 delete mode 100644 debian/patches/28_listen_localhost.patch
 create mode 100644 debian/patches/35_man-spelling.patch
 create mode 100644 debian/po/POTFILES.in
 create mode 100644 debian/po/de.po
 create mode 100644 debian/po/fr.po
 create mode 100644 debian/po/nl.po
 create mode 100644 debian/po/pt_BR.po
 create mode 100644 debian/po/sv.po
 create mode 100644 debian/po/templates.pot
 create mode 100644 debian/templates
 create mode 100644 debian/tests/control
 create mode 100755 debian/tests/privoxy-regression-test

diff --git a/debian/README.Debian b/debian/README.Debian
index 0a993fcc..6f905d4b 100644
--- a/debian/README.Debian
+++ b/debian/README.Debian
@@ -1,22 +1,6 @@
 privoxy for Debian
 ==================
 
-- enable-edit-actions, enable-remote-toggle, and
-  enable-remote-http-toggle are disabled in the Debian package for
-  security reasons, because these options allow every user of your
-  privoxy to change its configuration.  Except this there exist
-  exploits using Java and/or JavaScript that tell your browser to send
-  out requests for disabling the proxy or the filtering, which may
-  compromise your anonymity.  If you still want to use these features,
-  you can enable them in /etc/privoxy/config and do a
-  "/etc/init.d/privoxy restart".
-
-- Experimental IPv6 support was added to the package.
-
-- The global default for all URLs (/) is now set in match-all.action
-  in contrast to versions up to 3.0.10, where a Debian only patch
-  configured them in global.action.
-
 - Since 3.0.5 the upstream package uses the Cautious default settings
   instead of Medium (like 3.0.3 did).  To avoid problems on upgrades
   of old packages, the Debian package still uses the Medium settings.
@@ -44,4 +28,3 @@ privoxy for Debian
   editable again.
 
 Roland Rosenfeld <roland@debian.org>
-$Id: README.Debian,v 1.8 2009-02-22 21:07:20 roland Exp $
diff --git a/debian/changelog b/debian/changelog
index f5cfe613..c63c65e9 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,8 +1,51 @@
+privoxy (3.0.26-1) unstable; urgency=medium
+
+  * New upstream version 3.0.26.
+  * This includes 36_listen-nohost.patch.
+  * Updated all patches to new version.
+
+ -- Roland Rosenfeld <roland@debian.org>  Sat, 27 Aug 2016 22:28:32 +0200
+
+privoxy (3.0.25-2) unstable; urgency=medium
+
+  * Add pt_BR debconf translation.  Thanks to Adriano Rafael Gomes
+    (Closes: #827327).
+  * Symlink p_doc.css to user-manual.
+  * Install regression-tests.action.
+  * Enable autopkgtest and run privoxy-regression-test.pl.
+  * Install privoxy-regression-test and man page to binary package.
+  * Updated debian/copyright to catch all copyright variants.
+  * Remove outdated stuff from README.Debian.
+  * 36_listen-nohost: Fix crashes with "listen-addr :8118" (Closes: #834941).
+
+ -- Roland Rosenfeld <roland@debian.org>  Tue, 23 Aug 2016 09:27:34 +0200
+
+privoxy (3.0.25-1) unstable; urgency=medium
+
+  * New upstream version 3.0.25 (beta).
+  * Adapt all patches to new upstream version.
+  * Update debian/copyright to new privoxy home.
+  * Add sv debconf translation.  Thanks to Jonatan Nyberg (Closes: #824913).
+  * Add fr debconf translation.  Thanks to Steve Petruzzello (Closes: #825478).
+  * Add nl debconf translation.  Thanks to Frans Spiesschaert (Closes: #825691).
+  * privoxy.service: Run after network.target (Closes: #825358).
+
+ -- Roland Rosenfeld <roland@debian.org>  Sat, 28 May 2016 23:13:56 +0200
+
 privoxy (3.0.24-2) unstable; urgency=medium
 
-  * Upgrade Standards-Version to 3.9.7 (no changes).
+  * Upgrade Standards-Version to 3.9.8 (no changes).
+  * Add -p to QUILT_DIFF_OPTS.
+  * Add Documentation key to privoxy.service.
+  * 35_man-spelling: Fix spelling error in privoxy-log-parser(1).
+  * Add debconf and ucf support to make listen-address configurable.
+    Thanks to James Valleroy for providing the code (Closes: #798219).
+  * Remove 28_listen_localhost, but listen on 127.0.0.1:8118 and
+    [::1]:8118 by default, since otherwise privoxy listens only on IPv6
+    (Closes: #518010, #557443).
+  * Change several URLs from http to https.
 
- -- Roland Rosenfeld <roland@debian.org>  Thu, 04 Feb 2016 19:35:59 +0100
+ -- Roland Rosenfeld <roland@debian.org>  Sun, 01 May 2016 14:21:22 +0200
 
 privoxy (3.0.24-1) unstable; urgency=medium
 
@@ -90,13 +133,13 @@ privoxy (3.0.21-7) unstable; urgency=medium
 privoxy (3.0.21-5) unstable; urgency=low
 
   * 34_CVE-2015-1030: Fix memory leak in rfc2553_connect_to().  CID 66382
-  * 35_CVE-2015-1031-CID66394: unmap(): Prevent use-after-free if the map 
+  * 35_CVE-2015-1031-CID66394: unmap(): Prevent use-after-free if the map
     only consists of one item.  CID 66394.
   * 36_CVE-2015-1031-CID66376: pcrs_execute(): Consistently set *result to
     NULL in case of errors.  Should make use-after-free in the caller less
     likely.  CID 66391, CID 66376.
   * These 3 patches Closes: #775167.
-  
+
  -- Roland Rosenfeld <roland@debian.org>  Mon, 12 Jan 2015 08:44:23 +0100
 
 privoxy (3.0.21-4) unstable; urgency=low
@@ -143,6 +186,15 @@ privoxy (3.0.20-1) unstable; urgency=low
 
  -- Roland Rosenfeld <roland@debian.org>  Thu, 24 Jan 2013 17:40:51 +0100
 
+privoxy (3.0.19-2+deb7u4) oldstable; urgency=high
+
+  * 42_CVE-2013-2503: Proxy authentication headers are removed unless the
+    new directive enable-proxy-authentication-forwarding is used.
+    Forwarding the headers potentionally allows malicious sites to trick
+    the user into providing it with login information (Closes: #702896).
+
+ -- Roland Rosenfeld <roland@debian.org>  Tue, 08 Mar 2016 08:52:26 +0100
+
 privoxy (3.0.19-2+deb7u3) wheezy-security; urgency=high
 
   * 40_CVE-2016-1982: Prevent invalid reads in case of corrupt
@@ -163,7 +215,7 @@ privoxy (3.0.19-2+deb7u2) wheezy-security; urgency=medium
 
 privoxy (3.0.19-2+deb7u1) stable-security; urgency=medium
 
-  * 35_CVE-2015-1031-CID66394: unmap(): Prevent use-after-free if the map 
+  * 35_CVE-2015-1031-CID66394: unmap(): Prevent use-after-free if the map
     only consists of one item.  CID 66394.
   * 36_CVE-2015-1031-CID66376: pcrs_execute(): Consistently set *result to
     NULL in case of errors.  Should make use-after-free in the caller less
@@ -217,13 +269,13 @@ privoxy (3.0.17-1) unstable; urgency=low
 
 privoxy (3.0.16-1+deb6u2) squeeze-lts; urgency=high
 
-  * Non-maintainer upload by the Squeeze LTS Team. 
+  * Non-maintainer upload by the Squeeze LTS Team.
   * CVE-2016-1982
     Prevent invalid reads in case of corrupt chunk-encoded content
   * CVE-2016-1983
-    Remove empty Host headers in client requests; resulting in 
+    Remove empty Host headers in client requests; resulting in
     invalid reads.
- 
+
  -- Thorsten Alteholz <debian@alteholz.de>  Fri, 22 Jan 2016 18:03:02 +0100
 
 privoxy (3.0.16-1+deb6u1) squeeze-lts; urgency=medium
@@ -267,7 +319,7 @@ privoxy (3.0.15-3) unstable; urgency=low
 privoxy (3.0.15-2) unstable; urgency=low
 
   * 30_localhost_fixup: Remove workaround for "localhost" listen-address,
-    which should solve all problems with privoxy not starting. 
+    which should solve all problems with privoxy not starting.
     (Closes: #534735).
 
  -- Roland Rosenfeld <roland@debian.org>  Sun, 13 Dec 2009 10:09:11 +0100
@@ -331,7 +383,7 @@ privoxy (3.0.11-1) unstable; urgency=low
     weren't noticed, cause they are written to the console on start now
     (Closes: #375174)
   * Modify init.d script to be more lsb compliant.
-    Depends on lsb-base (>= 3.2-13) 
+    Depends on lsb-base (>= 3.2-13)
   * Allow disabling privoxy via RUN_DAEMON=no in /etc/default/privoxy.
     (Closes: #482563).
   * Update README.Debian to fit all changes.
@@ -342,7 +394,7 @@ privoxy (3.0.10-2) unstable; urgency=low
 
   * IPv6 patch added again: 03_ipv6: privoxy-3.0.10-ipv6-all-6.diff by
     Petr Písař (Closes: #179461).
-    It seems that the old bugs #391600 and #393605, which appeared with 
+    It seems that the old bugs #391600 and #393605, which appeared with
     the previous version, are fixed now.
   * 28_listen_localhost: Listen on localhost:8118 instead of 127.0.0.1:8118,
     because this is independent from localhost IP (127.0.0.1 vs. 127.0.1.1)
@@ -457,12 +509,12 @@ privoxy (3.0.6-1) unstable; urgency=low
 privoxy (3.0.5-beta-3) unstable; urgency=medium
 
   * Disable the IPv6 patch, because this is seems to have too many bugs
-    for a release right now.  
+    for a release right now.
     - This reopens #179461.
     - This solves the problem, that "listen-address :8118" listens on
       localhost only (Closes: #391600).
     - This solves the problem, that regex pattern at front of hostname
-      is ignored (Closes: #393605). 
+      is ignored (Closes: #393605).
   * Use /usr/share/dpatch/dpatch.make in debian/rules instead of adding
     the content by hand.
   * Extended version of 26_edit_only_writable.dpatch by Fabian Keil.  Now
@@ -482,8 +534,8 @@ privoxy (3.0.5-beta-2) unstable; urgency=low
 privoxy (3.0.5-beta-1) unstable; urgency=low
 
   * New upstream version 3.0.5-beta.
-  * hide-referrer{foo} now allows everything as a forged referrer not 
-    only http/https URLs and ignoring invalid URLs (Closes: #258193).  
+  * hide-referrer{foo} now allows everything as a forged referrer not
+    only http/https URLs and ignoring invalid URLs (Closes: #258193).
   * Fixes the name of the filter from "popups" to "all-popups" in
     user.action. (Closes: #385886).
   * Block http://www.google-analytics.com/urchin.js because this is used
@@ -586,7 +638,7 @@ privoxy (3.0.3-5) unstable; urgency=low
 
 privoxy (3.0.3-4) unstable; urgency=low
 
-  * Stop converting entities to 8bit chars in the documentation 
+  * Stop converting entities to 8bit chars in the documentation
     (Closes: #203697).
   * Fix typos ('persistant' and 'Januar') in man page and man page sources
     (Closes: #302145).
@@ -602,7 +654,7 @@ privoxy (3.0.3-4) unstable; urgency=low
 privoxy (3.0.3-3) unstable; urgency=low
 
   * Now really remove multiproxy.org from all documentation, not only from
-    the config file (Closes: #198953). 
+    the config file (Closes: #198953).
 
  -- Roland Rosenfeld <roland@debian.org>  Sun, 15 Feb 2004 23:11:29 +0100
 
@@ -629,13 +681,13 @@ privoxy (3.0.3-1) unstable; urgency=low
     - This introduces workarounds for server (PHP <4.2.3) bugs including
       the "blank page" problem (Closes: #215231).
     - Avoid the conversion of "open" in scripts to "PrivoxyWindowOpen"
-      (Closes: #197995). 
+      (Closes: #197995).
     - "advocancy" is no longer blocked (Closes: #202042).
     - Fixed yet another two memory leaks (Closes: #215911).
   * Stop backup of pdf directory, because it is no longer contained in the
     upstream package.
   * Create doc/pdf, which is missing upstream.
-  * disable filter{unsolicited-popups} for www.perl.com/language/newdocs/pod/ 
+  * disable filter{unsolicited-popups} for www.perl.com/language/newdocs/pod/
     to avoid problems with "PrivoxyWindowOpen" in Perl manuals
     (Closes: #195311).
   * Apply patch make privoxy compilable on woody where htmldoc --version
@@ -711,7 +763,7 @@ privoxy (3.0.0-5) unstable; urgency=low
 
   * Stop build-depending on special versions of libc6-dev and gcc.
     Hopefully all auto-builders run new versions which shouldn't cause
-    trouble (Closes: #182267)  
+    trouble (Closes: #182267)
 
  -- Roland Rosenfeld <roland@debian.org>  Mon, 24 Feb 2003 19:07:11 +0100
 
@@ -790,7 +842,7 @@ privoxy (2.9.16-1) unstable; urgency=low
   * Do no longer build html and txt versions of documentation using
     docbook, but use the converted versions which come with the upstream
     package.
-  * default.action fixed upstream: "downloads" no longer blocked 
+  * default.action fixed upstream: "downloads" no longer blocked
     (Closes: #148290).
   * default.filter fixed upstream: Made WeBugs job ungreedy (Closes: #149450).
   * Remove the "beta" from the version number (the final release will be
diff --git a/debian/config b/debian/config
new file mode 100755
index 00000000..a414300e
--- /dev/null
+++ b/debian/config
@@ -0,0 +1,25 @@
+#!/bin/sh
+set -e
+
+. /usr/share/debconf/confmodule
+
+CONFIG=/etc/privoxy/config
+
+# Get current configuration.
+if [ -e $CONFIG ]; then
+    LISTENADDRESS=$(perl -le '
+        my @listens;
+        while (<STDIN>) {
+            chomp;
+            if ($_ =~ m/^\s*listen-address\s+(\S+)/) {
+                push @listens, $1;
+            }
+        }
+        print "@listens\n";' \
+                         < $CONFIG)
+
+    db_set privoxy/listen-address "$LISTENADDRESS"
+fi
+
+db_input medium privoxy/listen-address || true
+db_go || true
diff --git a/debian/control b/debian/control
index 7aad0ca8..91197a89 100644
--- a/debian/control
+++ b/debian/control
@@ -13,18 +13,22 @@ Build-Depends: autoconf,
                jade,
                libpcre3-dev,
                man2html,
+               po-debconf,
                sgmlspl,
                sp,
                w3m,
                zlib1g-dev
-Standards-Version: 3.9.7
-Homepage: http://www.privoxy.org/
+Standards-Version: 3.9.8
+Homepage: https://www.privoxy.org/
+Testsuite: autopkgtest
 
 Package: privoxy
 Architecture: any
 Depends: adduser,
+         debconf,
          logrotate,
          lsb-base (>= 3.2-13),
+         ucf,
          ${misc:Depends},
          ${perl:Depends},
          ${shlibs:Depends}
diff --git a/debian/copyright b/debian/copyright
index c4d99ac5..4e584e0f 100644
--- a/debian/copyright
+++ b/debian/copyright
@@ -1,16 +1,68 @@
 Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
 Upstream-Name: Privoxy
-Upstream-Contact: Privoxy team <ijbswa-developers@lists.sourceforge.net>
-Source: http://sourceforge.net/projects/ijbswa/files/Sources/
+Upstream-Contact: Privoxy Developers <privoxy-devel@lists.privoxy.org>
+Source: http://www.privoxy.org/sf-download-mirror/Sources/
 
 Files: *
-Copyright: Written by and Copyright (C) 2001-2014 the Privoxy team.
-           http://www.privoxy.org/
-License: GPL-2
+Copyright:
+ Copyright (C) 2001-2016 by the Privoxy team. http://www.privoxy.org/
+ Parts Copyright (C) 1999 Adam Lock <locka@iol.ie>
+ Parts Copyright (C) 2003 Ian Cummings <ian_a_c@hotmail.com>
+ Parts Copyright (C) 2000, 2001 by Andreas S. Oesterhelt <andreas@oesterhelt.org>
+ Parts Copyright (C) 2006-2016 Fabian Keil <fk@fabiankeil.de>
+Comment:
  Based on the Internet Junkbuster originally written
  by and Copyright (C) 1997 Anonymous Coders and
  Junkbusters Corporation.  http://www.junkbusters.com
+License: GPL-2+
+
+Files: regression-tests.action tools/uagen.pl tools/privoxy-regression-test.pl
+ tools/privoxy-log-parser.pl tools/url-pattern-translator.pl utils/changelog2doc.pl
+ utils/create-package-feed.pl
+Copyright:
+ Copyright (c) 2006-2016 Fabian Keil <fk@fabiankeil.de>
+License: ISC
+
+Files: strptime.h
+Copyright:
+ Copyright (C) 1996, 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
+Comment:
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
+License: GPL-2+
+
+Files: debian/*
+Copyright:
+ 2002-2016  Roland Rosenfeld <roland@debian.org>
+License: GPL-2+
+
+Files: pcre/*
+Copyright: Copyright (c) 1997-2000 University of Cambridge
+Comment: 
+ Written by: Philip Hazel <ph10@cam.ac.uk>
+ .
+ University of Cambridge Computing Service,
+ Cambridge, England. Phone: +44 1223 334714.
+License: BSD-like
+ Permission is granted to anyone to use this software for any purpose on any
+ computer system, and to redistribute it freely, subject to the following
+ restrictions:
  .
+ 1. This software 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.
+ .
+ 2. The origin of this software must not be misrepresented, either by
+    explicit claim or by omission.
+ .  
+ 3. Altered versions must be plainly marked as such, and must not be
+    misrepresented as being the original software.
+ .
+ 4. If PCRE is embedded in any software that is released under the GNU
+    General Purpose Licence (GPL), then the terms of that licence shall
+    supersede any condition above with which it is incompatible.
+
+License: GPL-2+
  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
@@ -32,3 +84,16 @@ License: GPL-2
  On Debian systems, the full text of the GNU General Public
  License version 2 can be found in the file
  `/usr/share/common-licenses/GPL-2'.
+
+License: ISC
+ Permission to use, copy, modify, and distribute this software for any
+ purpose with or without fee is hereby granted, provided that the above
+ copyright notice and this permission notice appear in all copies.
+ .
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
diff --git a/debian/dirs b/debian/dirs
index eb41624d..247ec29d 100644
--- a/debian/dirs
+++ b/debian/dirs
@@ -2,5 +2,6 @@ etc/privoxy
 usr/bin
 usr/sbin
 usr/share/doc/privoxy
+usr/share/privoxy
 var/log/privoxy
 usr/share/man/man1
diff --git a/debian/patches/05_defaut_action.patch b/debian/patches/05_defaut_action.patch
index 8cda9ade..ee3b0618 100644
--- a/debian/patches/05_defaut_action.patch
+++ b/debian/patches/05_defaut_action.patch
@@ -3,7 +3,7 @@ Description: Serveral changes/additons to default.action.
 
 --- a/default.action.master
 +++ b/default.action.master
-@@ -2413,6 +2413,9 @@ schneegans.de/sv/\?url=referer
+@@ -2419,6 +2419,9 @@ schneegans.de/sv/\?url=referer
  #MASTER# REMARKS: Exclude per Debian bug report #377843
  # URL = http://blogs.msdn.com/wga/archive/2006/07/16/667063.aspx
  blogs.msdn.com
@@ -13,7 +13,7 @@ Description: Serveral changes/additons to default.action.
  
  {-filter{unsolicited-popups}}
  # Sticky Actions = -filter{unsolicited-popups}
-@@ -2471,6 +2474,11 @@ tr.anp.se/
+@@ -2477,6 +2480,11 @@ tr.anp.se/
  {+filter{tiny-textforms}}
  .sourceforge.net/tracker
  
diff --git a/debian/patches/14_config.patch b/debian/patches/14_config.patch
index 943f36dd..797d6e1a 100644
--- a/debian/patches/14_config.patch
+++ b/debian/patches/14_config.patch
@@ -3,20 +3,11 @@ Description: Several Debian specific changes to config file
 
 --- a/config
 +++ b/config
-@@ -1,6 +1,6 @@
--#        Sample Configuration File for Privoxy 3.0.24
-+#        Sample Configuration File for Privoxy
- #
--#  $Id: config,v 1.108 2016/01/17 14:33:03 fabiankeil Exp $
-+#  Id: config,v
- #
- #  Copyright (C) 2001-2014 Privoxy Developers http://www.privoxy.org/
- #
 @@ -128,7 +128,7 @@
  #          config file, because it is used while the config file is
  #          being read.
  #
--#user-manual http://www.privoxy.org/user-manual/
+-#user-manual https://www.privoxy.org/user-manual/
 +user-manual /usr/share/doc/privoxy/user-manual
  #
  #  1.2. trust-info-url
diff --git a/debian/patches/25_standard_medium.patch b/debian/patches/25_standard_medium.patch
index a91ede0b..855b1330 100644
--- a/debian/patches/25_standard_medium.patch
+++ b/debian/patches/25_standard_medium.patch
@@ -5,10 +5,10 @@ Description: Change the global default from standard.Cautious to
 
 --- a/match-all.action
 +++ b/match-all.action
-@@ -10,7 +10,16 @@
- +change-x-forwarded-for{block} \
+@@ -11,7 +11,16 @@
  +client-header-tagger{css-requests} \
  +client-header-tagger{image-requests} \
+ +client-header-tagger{range-requests} \
 ++deanimate-gifs{last} \
 ++filter{refresh-tags} \
 ++filter{img-reorder} \
diff --git a/debian/patches/27_remove_nsl.patch b/debian/patches/27_remove_nsl.patch
index e8c5657b..b1f666e8 100644
--- a/debian/patches/27_remove_nsl.patch
+++ b/debian/patches/27_remove_nsl.patch
@@ -3,7 +3,7 @@ Description: Remove unnecessary linking against libnsl.
 
 --- a/configure.in
 +++ b/configure.in
-@@ -470,7 +470,7 @@ dnl gmtime and localtime
+@@ -491,7 +491,7 @@ dnl gmtime and localtime
  dnl =================================================================
  
  dnl Next line needed to find the gethost*_r functions on Solaris
diff --git a/debian/patches/28_listen_localhost.patch b/debian/patches/28_listen_localhost.patch
deleted file mode 100644
index df0f43ac..00000000
--- a/debian/patches/28_listen_localhost.patch
+++ /dev/null
@@ -1,17 +0,0 @@
-Author: Roland Rosenfeld <roland@debian.org>
-Description: Listen on localhost:8118 instead of 127.0.0.1:8118, because
- this is independent from localhost IP (127.0.0.1 vs. 127.0.1.1)
- and also supports IPv6 (Closes: #512888)
-Bug-Debian: http://bugs.debian.org/512888
-
---- a/config
-+++ b/config
-@@ -780,7 +780,7 @@ logfile logfile
- #
- #        listen-address [::1]:8118
- #
--listen-address  127.0.0.1:8118
-+listen-address  localhost:8118
- #
- #  4.2. toggle
- #  ============
diff --git a/debian/patches/33_manpage_hyphen.patch b/debian/patches/33_manpage_hyphen.patch
index aa229942..518ce556 100644
--- a/debian/patches/33_manpage_hyphen.patch
+++ b/debian/patches/33_manpage_hyphen.patch
@@ -3,7 +3,7 @@ Description: Replace all -- in man page by \-\- to make lintian happy.
 
 --- a/GNUmakefile.in
 +++ b/GNUmakefile.in
-@@ -474,8 +474,7 @@ man: dok-release
+@@ -484,8 +484,7 @@ man: dok-release
  	perl -pi.bak -e "s/\[ /\[/g;s/á/\\\\['a]/g;s/é/\\\\['e]/g" $(MAN_PAGE); \
  	perl -pi.bak -e "s/ö/\\\\[:o]/g" $(MAN_PAGE); \
  	perl -pi.bak -e 's/([ {])-([a-z])/$$1\\-$$2/g' $(MAN_PAGE); \
diff --git a/debian/patches/34_system-docbook2man.patch b/debian/patches/34_system-docbook2man.patch
index 11288bc6..e122046f 100644
--- a/debian/patches/34_system-docbook2man.patch
+++ b/debian/patches/34_system-docbook2man.patch
@@ -4,7 +4,7 @@ Description: Use Debian docbook2man-spec.pl (from docbook-utils)
 
 --- a/GNUmakefile.in
 +++ b/GNUmakefile.in
-@@ -469,7 +469,7 @@ dok-man:
+@@ -479,7 +479,7 @@ dok-man:
  # target for man page generation!
  man: dok-release
  	mkdir -p doc/source/temp && cd doc/source/temp && $(RM) * ;\
diff --git a/debian/patches/35_man-spelling.patch b/debian/patches/35_man-spelling.patch
new file mode 100644
index 00000000..5ec462ca
--- /dev/null
+++ b/debian/patches/35_man-spelling.patch
@@ -0,0 +1,14 @@
+Description: Fix typo in man page privoxy-log-parser(1)
+Author: Roland Rosenfeld <roland@debian.org>
+
+--- a/tools/privoxy-log-parser.pl
++++ b/tools/privoxy-log-parser.pl
+@@ -2612,7 +2612,7 @@ omitted, ANSI escape sequences are used
+ This option is only intended to make embedding log excerpts in web pages easier.
+ It does not escape any input!
+ 
+-[B<--no-msecs>] Don't expect milisecond resolution
++[B<--no-msecs>] Don't expect millisecond resolution
+ 
+ [B<--no-syntax-highlighting>] Disable syntax-highlighting. Useful when
+ the filtered output is piped into less in which case the ANSI control
diff --git a/debian/patches/series b/debian/patches/series
index 1ef2478f..b26a4b2d 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -5,7 +5,7 @@
 17_502_no_such_domain.patch
 25_standard_medium.patch
 27_remove_nsl.patch
-28_listen_localhost.patch
 32_bind_fixup.patch
 33_manpage_hyphen.patch
 34_system-docbook2man.patch
+35_man-spelling.patch
diff --git a/debian/po/POTFILES.in b/debian/po/POTFILES.in
new file mode 100644
index 00000000..98e8416d
--- /dev/null
+++ b/debian/po/POTFILES.in
@@ -0,0 +1 @@
+[type: gettext/rfc822deb] templates
\ No newline at end of file
diff --git a/debian/po/de.po b/debian/po/de.po
new file mode 100644
index 00000000..b81ea167
--- /dev/null
+++ b/debian/po/de.po
@@ -0,0 +1,32 @@
+# Translation of privoxy debconf templates to German
+# Copyright (C) 2016  Roland Rosenfeld <roland@debian.org>
+# This file is distributed under the same license as the PACKAGE package.
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: privoxy\n"
+"Report-Msgid-Bugs-To: privoxy@packages.debian.org\n"
+"POT-Creation-Date: 2016-04-08 17:17+0200\n"
+"PO-Revision-Date: 2016-04-08 17:18+0200\n"
+"Last-Translator: Roland Rosenfeld <roland@debian.org>\n"
+"Language-Team: German <debian-l10n-german@lists.debian.org>\n"
+"Language: de\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#. Type: string
+#. Description
+#: ../templates:1001
+msgid "Adresses on with Privoxy listens:"
+msgstr "Adressen, unter denen Privoxy auf Anfragen hört:"
+
+#. Type: string
+#. Description
+#: ../templates:1001
+msgid ""
+"Please enter a space separated list of address:port combinations on which "
+"Privoxy will listen for client requests."
+msgstr ""
+"Bitte geben Sie eine durch Leerzeichen getrennte Liste von "
+"Adresse:Port Kombinationen an, unter denen Privoxy auf Anfragen hört."
diff --git a/debian/po/fr.po b/debian/po/fr.po
new file mode 100644
index 00000000..31883937
--- /dev/null
+++ b/debian/po/fr.po
@@ -0,0 +1,34 @@
+# Translation of privoxy debconf template to French
+# Copyright (C) 2016 Debian French l10n Team <debian-l10n-french@lists.debian.org>
+# This file is distributed under the same license as the privoxy package.
+# Translator:
+# Steve Petruzzello <dlist@bluewin.ch>, 2016
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: privoxy_3.0.24_2\n"
+"Report-Msgid-Bugs-To: privoxy@packages.debian.org\n"
+"POT-Creation-Date: 2016-04-08 17:17+0200\n"
+"PO-Revision-Date: 2016-05-27 08:57+0200\n"
+"Last-Translator: Steve Petruzzello <dlist@bluewin.ch>\n"
+"Language-Team: French <debian-l10n-french@lists.debian.org>\n"
+"Language: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=utf-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#. Type: string
+#. Description
+#: ../templates:1001
+msgid "Adresses on with Privoxy listens:"
+msgstr "Adresse(s) d'écoute pour Privoxy :"
+
+#. Type: string
+#. Description
+#: ../templates:1001
+msgid ""
+"Please enter a space separated list of address:port combinations on which "
+"Privoxy will listen for client requests."
+msgstr ""
+"Veuillez indiquer une liste séparée par des espaces des adresses de la forme "
+"adresse:port sur lesquelles Privoxy attend des requêtes de clients. "
diff --git a/debian/po/nl.po b/debian/po/nl.po
new file mode 100644
index 00000000..b9ed34b2
--- /dev/null
+++ b/debian/po/nl.po
@@ -0,0 +1,36 @@
+# Dutch translation of privoxy debconf templates.
+# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
+# This file is distributed under the same license as the privoxy package.
+# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
+# Frans Spiesschaert <Frans.Spiesschaert@yucom.be>, 2016.
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: privoxy\n"
+"Report-Msgid-Bugs-To: privoxy@packages.debian.org\n"
+"POT-Creation-Date: 2016-04-08 17:17+0200\n"
+"PO-Revision-Date: 2016-05-04 21:57+0200\n"
+"Last-Translator: Frans Spiesschaert <Frans.Spiesschaert@yucom.be>\n"
+"Language-Team: Debian Dutch l10n Team <debian-l10n-dutch@lists.debian.org>\n"
+"Language: nl\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Plural-Forms: nplurals=2; plural=(n != 1);\n"
+"X-Generator: Gtranslator 2.91.6\n"
+
+#. Type: string
+#. Description
+#: ../templates:1001
+msgid "Adresses on with Privoxy listens:"
+msgstr "Adressen waarop Privoxy luistert:"
+
+#. Type: string
+#. Description
+#: ../templates:1001
+msgid ""
+"Please enter a space separated list of address:port combinations on which "
+"Privoxy will listen for client requests."
+msgstr ""
+"Geef een door spaties gescheiden lijst in van combinaties van adres:poort "
+"waarop Privoxy cliëntverzoeken zal beluisteren."
diff --git a/debian/po/pt_BR.po b/debian/po/pt_BR.po
new file mode 100644
index 00000000..fb115480
--- /dev/null
+++ b/debian/po/pt_BR.po
@@ -0,0 +1,34 @@
+# Debconf translations for privoxy.
+# Copyright (C) 2016 THE privoxy'S COPYRIGHT HOLDER
+# This file is distributed under the same license as the privoxy package.
+# Adriano Rafael Gomes <adrianorg@arg.eti.br>, 2016.
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: privoxy\n"
+"Report-Msgid-Bugs-To: privoxy@packages.debian.org\n"
+"POT-Creation-Date: 2016-04-08 17:17+0200\n"
+"PO-Revision-Date: 2016-05-20 20:59-0300\n"
+"Last-Translator: Adriano Rafael Gomes <adrianorg@arg.eti.br>\n"
+"Language-Team: Brazilian Portuguese <debian-l10n-portuguese@lists.debian."
+"org>\n"
+"Language: pt_BR\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#. Type: string
+#. Description
+#: ../templates:1001
+msgid "Adresses on with Privoxy listens:"
+msgstr "Endereços nos quais o Privoxy escuta:"
+
+#. Type: string
+#. Description
+#: ../templates:1001
+msgid ""
+"Please enter a space separated list of address:port combinations on which "
+"Privoxy will listen for client requests."
+msgstr ""
+"Por favor, informe uma lista separada por espaços de combinações de endereço:"
+"porta nas quais o Privoxy escutará por requisições de clientes."
diff --git a/debian/po/sv.po b/debian/po/sv.po
new file mode 100644
index 00000000..d899f5ec
--- /dev/null
+++ b/debian/po/sv.po
@@ -0,0 +1,32 @@
+# SOME DESCRIPTIVE TITLE.
+# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
+# This file is distributed under the same license as the PACKAGE package.
+# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: privoxy\n"
+"Report-Msgid-Bugs-To: privoxy@packages.debian.org\n"
+"POT-Creation-Date: 2016-04-08 17:17+0200\n"
+"PO-Revision-Date: 2016-05-21 09:51+0100\n"
+"Last-Translator: Jonatan Nyberg <jonatan@autistici.org>\n"
+"Language-Team: LANGUAGE <LL@li.org>\n"
+"Language: sv\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Plural-Forms: nplurals=2; plural=(n != 1);\n"
+"X-Generator: Poedit 1.6.10\n"
+
+#. Type: string
+#. Description
+#: ../templates:1001
+msgid "Adresses on with Privoxy listens:"
+msgstr "Adresser som Privoxy lyssnar på:"
+
+#. Type: string
+#. Description
+#: ../templates:1001
+msgid "Please enter a space separated list of address:port combinations on which Privoxy will listen for client requests."
+msgstr "Ange en mellanslag separerad lista med adress:port kombinationer som Privoxy kommer att lyssna på för klientförfrågningar."
+
diff --git a/debian/po/templates.pot b/debian/po/templates.pot
new file mode 100644
index 00000000..d5e48d56
--- /dev/null
+++ b/debian/po/templates.pot
@@ -0,0 +1,32 @@
+# SOME DESCRIPTIVE TITLE.
+# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
+# This file is distributed under the same license as the PACKAGE package.
+# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
+#
+#, fuzzy
+msgid ""
+msgstr ""
+"Project-Id-Version: privoxy\n"
+"Report-Msgid-Bugs-To: privoxy@packages.debian.org\n"
+"POT-Creation-Date: 2016-04-08 17:17+0200\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
+"Language-Team: LANGUAGE <LL@li.org>\n"
+"Language: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=CHARSET\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#. Type: string
+#. Description
+#: ../templates:1001
+msgid "Adresses on with Privoxy listens:"
+msgstr ""
+
+#. Type: string
+#. Description
+#: ../templates:1001
+msgid ""
+"Please enter a space separated list of address:port combinations on which "
+"Privoxy will listen for client requests."
+msgstr ""
diff --git a/debian/postinst b/debian/postinst
index f55b3c8d..f79ccb16 100644
--- a/debian/postinst
+++ b/debian/postinst
@@ -25,6 +25,9 @@ set -e
 
 CONFDIR=/etc/privoxy
 CONFIG=$CONFDIR/config
+EXAMPLE_CONFIG=/usr/share/privoxy/config
+
+. /usr/share/debconf/confmodule
 
 case "$1" in
     configure)
@@ -36,6 +39,28 @@ case "$1" in
 	[ -f $CONFDIR/match-all.action ] \
 	    && chown privoxy $CONFDIR/match-all.action
 
+	db_get privoxy/listen-address || true
+	perl -le '
+                $done = 0;
+                while (<STDIN>) {
+                    chomp;
+                    if ($_ =~ m/^\s*listen-address\s+.*/) {
+                        if (!$done) {
+                            foreach (@ARGV) {
+                                print "listen-address  $_";
+                            }
+                        }
+                        $done = 1;
+                    } else {
+                        print;
+                    }
+                }' \
+	     $RET \
+	     < $EXAMPLE_CONFIG > $CONFIG.ucftmp
+	ucf --three-way --debconf-ok $CONFIG.ucftmp $CONFIG
+	ucfr privoxy $CONFIG
+	rm -f $CONFIG.ucftmp
+
 	if [ "x$2" != "x" ] && dpkg --compare-versions "$2" lt "3.0.4"
 	then
 	    # Upgrading from a 3.0.3* version
diff --git a/debian/postrm b/debian/postrm
index 3b761d09..afd3038e 100644
--- a/debian/postrm
+++ b/debian/postrm
@@ -21,7 +21,17 @@ set -e
 case "$1" in
     purge)
         # deluser --quiet privoxy
+        if [ -x "$(which ucf 2>/dev/null)" ]; then
+            ucf --purge /etc/privoxy/config
+        fi
+        if [ -x "$(which ucfr 2>/dev/null)" ]; then
+            ucfr --purge privoxy /etc/privoxy/config
+        fi
         rm -rf /var/log/privoxy /etc/privoxy
+        if [ -e /usr/share/debconf/confmodule ]; then
+            . /usr/share/debconf/confmodule
+            db_purge
+        fi
         ;;
 
     remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)
diff --git a/debian/privoxy.service b/debian/privoxy.service
index 63cd84b4..f7b3f5dd 100644
--- a/debian/privoxy.service
+++ b/debian/privoxy.service
@@ -1,5 +1,7 @@
 [Unit]
 Description=Privacy enhancing HTTP Proxy
+Documentation=man:privoxy(8) https://www.privoxy.org/user-manual/
+After=network.target
 
 [Service]
 Environment=PIDFILE=/var/run/privoxy.pid
diff --git a/debian/rules b/debian/rules
index 113dadb7..564aa84e 100755
--- a/debian/rules
+++ b/debian/rules
@@ -1,6 +1,6 @@
 #!/usr/bin/make -f
 #
-# (c) 2002-2015 Roland Rosenfeld <roland@debian.org>
+# (c) 2002-2016 Roland Rosenfeld <roland@debian.org>
 #
 # Uncomment this to turn on verbose mode.
 #export DH_VERBOSE=1
@@ -51,10 +51,14 @@ override_dh_auto_clean:
 
 override_dh_auto_install:
 	install -m 0755 privoxy $(DEBDIR)/usr/sbin/privoxy
-	install -m 644 config $(DEBDIR)/etc/privoxy/config
+	sed -e 's/\(Sample Configuration File for Privoxy\).*/\1/;' \
+	    -e 's/\$$Id: config,v.*/Id: config,v/' < config \
+	    > $(DEBDIR)/usr/share/privoxy/config
 	install -m 0644 default.action $(DEBDIR)/etc/privoxy/default.action
 	install -m 0644 match-all.action $(DEBDIR)/etc/privoxy/match-all.action
 	install -m 0644 user.action $(DEBDIR)/etc/privoxy/user.action
+	install -m 0644 regression-tests.action \
+		$(DEBDIR)/etc/privoxy/regression-tests.action
 	install -m 0644 default.filter $(DEBDIR)/etc/privoxy/default.filter
 	install -m 0644 user.filter $(DEBDIR)/etc/privoxy/user.filter
 	install -m 0644 trust $(DEBDIR)/etc/privoxy/trust
@@ -64,6 +68,11 @@ override_dh_auto_install:
 	pod2man tools/privoxy-log-parser.pl \
 		> $(DEBDIR)/usr/share/man/man1/privoxy-log-parser.1
 
+	install -m 0755 tools/privoxy-regression-test.pl \
+		$(DEBDIR)/usr/bin/privoxy-regression-test
+	pod2man tools/privoxy-regression-test.pl \
+		> $(DEBDIR)/usr/share/man/man1/privoxy-regression-test.1
+
 	cp -r templates $(DEBDIR)/etc/privoxy/
 	rm -f $(DEBDIR)/etc/privoxy/templates/*~
 	rm -rf $(DEBDIR)/etc/privoxy/templates/CVS
@@ -83,6 +92,7 @@ override_dh_installdocs:
 	dh_installdocs -XCVS
 	(cd $(DEBDIR)/usr/share/doc/privoxy/; \
 	 mv privoxy-index.html index.html)
+	(cd $(DEBDIR)/usr/share/doc/privoxy/user-manual; ln -s '../p_doc.css')
 
 override_dh_perl:
 #	We only need perl-base:
diff --git a/debian/templates b/debian/templates
new file mode 100644
index 00000000..e1af00fa
--- /dev/null
+++ b/debian/templates
@@ -0,0 +1,6 @@
+Template: privoxy/listen-address
+Type: string
+Default: 127.0.0.1:8118 [::1]:8118
+_Description: Adresses on with Privoxy listens:
+ Please enter a space separated list of address:port combinations on
+ which Privoxy will listen for client requests.
diff --git a/debian/tests/control b/debian/tests/control
new file mode 100644
index 00000000..6968f2af
--- /dev/null
+++ b/debian/tests/control
@@ -0,0 +1,2 @@
+Tests: privoxy-regression-test
+Depends: @, curl
diff --git a/debian/tests/privoxy-regression-test b/debian/tests/privoxy-regression-test
new file mode 100755
index 00000000..3122a1a6
--- /dev/null
+++ b/debian/tests/privoxy-regression-test
@@ -0,0 +1,44 @@
+#!/bin/sh
+#
+# Run privoxy-regression-test.pl on a configuration extended by
+# regression-tests.action.
+#
+# (c) 2016 Roland Rosenfeld <roland@debian.org>
+
+PORT=8119
+
+if [ -z "$ADTTMP" ]; then
+    ADTTMP=$(mktemp -d)
+fi
+
+CONFIG=$ADTTMP/config
+PIDFILE=$ADTTMP/privoxy.pid
+sed -e "s/^listen-address.*/listen-address 127.0.0.1:$PORT/" \
+    -e "s%^logdir.*%logdir $ADTTMP%" \
+    -e "s/^enable-edit-actions.*/enable-edit-actions 1/" \
+    -e "s/^keep-alive-timeout.*/keep-alive-timeout 21/" \
+    -e "s/^#connection-sharing.*/connection-sharing 1/" \
+    < /usr/share/privoxy/config > $CONFIG
+echo "actionsfile regression-tests.action" >> $CONFIG
+
+echo "Starting privoxy on port $PORT"
+/usr/sbin/privoxy --pidfile $PIDFILE $CONFIG
+
+http_proxy=http://127.0.0.1:$PORT/
+export http_proxy
+
+OUTFILE=$ADTTMP/output
+
+/usr/bin/privoxy-regression-test --max-level 200 --show-skipped-tests \
+    | tee $OUTFILE 2>&1
+
+echo "Stopping privoxy on port $PORT"
+kill $(cat $PIDFILE)
+
+if grep -q 'Executed.*, 0 failures.' $OUTFILE
+then
+    exit 0
+else
+    exit 1
+fi
+
-- 
2.49.0