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/16] dont choke on empty URI path
Date Wed, 20 Sep 2006 02:33:59 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: modules/cache/cache_util.c
===================================================================
--- modules/cache/cache_util.c.orig
+++ modules/cache/cache_util.c
@@ -67,9 +67,23 @@
         }
     }
 
+    /* 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