httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Davi Arnaut <d...@haxent.com.br>
Subject [patch 06/10] dont choke on empty URI path
Date Mon, 24 Jul 2006 00:50:36 GMT
According to my reading of 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/

Index: trunk/modules/cache/cache_util.c
===================================================================
--- trunk.orig/modules/cache/cache_util.c
+++ trunk/modules/cache/cache_util.c
@@ -67,9 +67,23 @@ static int uri_meets_conditions(const ap
         }
     }
 
+    /* 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.
      */
+
     return !strncmp(filter->path, url->path, pathlen);
 }
 

--

Mime
View raw message