From d010f24449d57380cccd15e456c6755708d6a7eb Mon Sep 17 00:00:00 2001 From: Graham Leggett Date: Tue, 26 Sep 2006 14:36:43 +0000 Subject: [PATCH] mod_cache: From RFC3986 (section 6.2.3.) if a URI contains an authority component and an empty path, the empty path is to be equivalent to "/". It explicitly cites the following four URIs as equivalents: http://example.com http://example.com/ http://example.com:/ http://example.com:80/ git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@450063 13f79535-47bb-0310-9956-ffa450edef68 --- CHANGES | 9 +++++++++ modules/cache/cache_util.c | 12 ++++++++++++ 2 files changed, 21 insertions(+) diff --git a/CHANGES b/CHANGES index caf9d24776..3ebe406342 100644 --- a/CHANGES +++ b/CHANGES @@ -2,6 +2,15 @@ Changes with Apache 2.3.0 [Remove entries to the current 2.0 and 2.2 section below, when backported] + *) mod_cache: From RFC3986 (section 6.2.3.) if a URI contains an + authority component and an empty path, the empty path is to be equivalent + to "/". It explicitly cites the following four URIs as equivalents: + http://example.com + http://example.com/ + http://example.com:/ + http://example.com:80/ + [Davi Arnaut ] + *) mod_cache: Don't cache requests with a expires date in the past; otherwise mod_cache will always try to cache the URL. This bug might lead to numerous rename() errors on win32 if the URL was diff --git a/modules/cache/cache_util.c b/modules/cache/cache_util.c index 5889ec4bfc..f2f9179125 100644 --- a/modules/cache/cache_util.c +++ b/modules/cache/cache_util.c @@ -65,6 +65,18 @@ static int uri_meets_conditions(apr_uri_t filter, int pathlen, apr_uri_t url) } } + /* For HTTP caching purposes, an empty (NULL) path is equivalent to + * a single "/" path. RFCs 3986/2396 + */ + if (!url.path) { + if (*filter.path == '/' && pathlen == 1) { + return 1; + } + else { + return 0; + } + } + /* Url has met all of the filter conditions so far, determine * if the paths match. */ -- 2.49.0