[Pkg-apache-commits] r1068 - in /trunk/apache2: changelog patches/00list patches/071_fix_cacheenable.dpatch

sf at alioth.debian.org sf at alioth.debian.org
Mon Oct 19 18:21:00 UTC 2009


Author: sf
Date: Mon Oct 19 18:20:59 2009
New Revision: 1068

URL: http://svn.debian.org/wsvn/pkg-apache/?sc=1&rev=1068
Log:
Fix 'CacheEnable http://'

Added:
    trunk/apache2/patches/071_fix_cacheenable.dpatch
Modified:
    trunk/apache2/changelog
    trunk/apache2/patches/00list

Modified: trunk/apache2/changelog
URL: http://svn.debian.org/wsvn/pkg-apache/trunk/apache2/changelog?rev=1068&op=diff
==============================================================================
--- trunk/apache2/changelog (original)
+++ trunk/apache2/changelog Mon Oct 19 18:20:59 2009
@@ -3,6 +3,7 @@
   * Allow RemoveType to override the types from /etc/mime.types. This allows
     to use .es and .tr for Spanish and Turkish files in mod_negotiation.
     Closes: #496080
+  * Fix 'CacheEnable http://'. Closes: #442266
 
  -- Stefan Fritsch <sf at debian.org>  Mon, 19 Oct 2009 19:50:11 +0200
 

Modified: trunk/apache2/patches/00list
URL: http://svn.debian.org/wsvn/pkg-apache/trunk/apache2/patches/00list?rev=1068&op=diff
==============================================================================
--- trunk/apache2/patches/00list (original)
+++ trunk/apache2/patches/00list Mon Oct 19 18:20:59 2009
@@ -20,6 +20,7 @@
 068_mod_dav_detect_EOF.dpatch
 069_no_deflate_for_HEAD.dpatch
 070_RemoveType_override_mime.types.dpatch
+071_fix_cacheenable.dpatch
 099_config_guess_sub_update
 200_cp_suexec.dpatch
 201_build_suexec-custom.dpatch

Added: trunk/apache2/patches/071_fix_cacheenable.dpatch
URL: http://svn.debian.org/wsvn/pkg-apache/trunk/apache2/patches/071_fix_cacheenable.dpatch?rev=1068&op=file
==============================================================================
--- trunk/apache2/patches/071_fix_cacheenable.dpatch (added)
+++ trunk/apache2/patches/071_fix_cacheenable.dpatch Mon Oct 19 18:20:59 2009
@@ -1,0 +1,118 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+##
+## All lines beginning with `## DP:' are a description of the patch.
+## DP: Bug #442266
+## DP: r821333,r821538,r821539 from upstream svn
+
+ at DPATCH@
+diff --git a/modules/cache/cache_util.c b/modules/cache/cache_util.c
+index ec2d749..aec7b09 100644
+--- a/modules/cache/cache_util.c
++++ b/modules/cache/cache_util.c
+@@ -27,41 +27,78 @@ extern module AP_MODULE_DECLARE_DATA cache_module;
+ /* Determine if "url" matches the hostname, scheme and port and path
+  * in "filter". All but the path comparisons are case-insensitive.
+  */
+-static int uri_meets_conditions(apr_uri_t filter, int pathlen, apr_uri_t url)
+-{
+-    /* Compare the hostnames */
+-    if(filter.hostname) {
+-        if (!url.hostname) {
+-            return 0;
+-        }
+-        else if (strcasecmp(filter.hostname, url.hostname)) {
+-            return 0;
+-        }
+-    }
++static int uri_meets_conditions(const apr_uri_t filter, const int pathlen,
++        const apr_uri_t url) {
++
++    /* Scheme, hostname port and local part. The filter URI and the
++     * URI we test may have the following shapes:
++     *   /<path>
++     *   <scheme>[:://<hostname>[:<port>][/<path>]]
++     * That is, if there is no scheme then there must be only the path,
++     * and we check only the path; if there is a scheme, we check the
++     * scheme for equality, and then if present we match the hostname,
++     * and then if present match the port, and finally the path if any.
++     *
++     * Note that this means that "/<path>" only matches local paths,
++     * and to match proxied paths one *must* specify the scheme.
++     */
+ 
+-    /* Compare the schemes */
+-    if(filter.scheme) {
+-        if (!url.scheme) {
+-            return 0;
+-        }
+-        else if (strcasecmp(filter.scheme, url.scheme)) {
++    /* Is the filter is just for a local path or a proxy URI? */
++    if (!filter.scheme) {
++        if (url.scheme || url.hostname) {
+             return 0;
+         }
+     }
+-
+-    /* Compare the ports */
+-    if(filter.port_str) {
+-        if (url.port_str && filter.port != url.port) {
++    else {
++        /* The URI scheme must be present and identical except for case. */
++        if (!url.scheme || strcasecmp(filter.scheme, url.scheme)) {
+             return 0;
+         }
+-        /* NOTE:  ap_port_of_scheme will return 0 if given NULL input */
+-        else if (filter.port != apr_uri_port_of_scheme(url.scheme)) {
+-            return 0;
++
++        /* If the filter hostname is null or empty it matches any hostname,
++         * if it begins with a "*" it matches the _end_ of the URI hostname
++         * excluding the "*", if it begins with a "." it matches the _end_
++         * of the URI * hostname including the ".", otherwise it must match
++         * the URI hostname exactly. */
++
++        if (filter.hostname && filter.hostname[0]) {
++            if (filter.hostname[0] == '.') {
++                const size_t fhostlen = strlen(filter.hostname);
++                const size_t uhostlen = url.hostname ? strlen(url.hostname) : 0;
++
++                if (fhostlen > uhostlen || strcasecmp(filter.hostname,
++                        url.hostname + uhostlen - fhostlen)) {
++                    return 0;
++                }
++            }
++            else if (filter.hostname[0] == '*') {
++                const size_t fhostlen = strlen(filter.hostname + 1);
++                const size_t uhostlen = url.hostname ? strlen(url.hostname) : 0;
++
++                if (fhostlen > uhostlen || strcasecmp(filter.hostname + 1,
++                        url.hostname + uhostlen - fhostlen)) {
++                    return 0;
++                }
++            }
++            else if (!url.hostname || strcasecmp(filter.hostname, url.hostname)) {
++                return 0;
++            }
+         }
+-    }
+-    else if(url.port_str && filter.scheme) {
+-        if (apr_uri_port_of_scheme(filter.scheme) == url.port) {
+-            return 0;
++
++        /* If the filter port is empty it matches any URL port.
++         * If the filter or URL port are missing, or the URL port is
++         * empty, they default to the port for their scheme. */
++
++        if (!(filter.port_str && !filter.port_str[0])) {
++            /* NOTE:  ap_port_of_scheme will return 0 if given NULL input */
++            const unsigned fport = filter.port_str ? filter.port
++                    : apr_uri_port_of_scheme(filter.scheme);
++            const unsigned uport = (url.port_str && url.port_str[0])
++                    ? url.port : apr_uri_port_of_scheme(url.scheme);
++
++            if (fport != uport) {
++                return 0;
++            }
+         }
+     }
+ 




More information about the Pkg-apache-commits mailing list