[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Noise: spicy autoindex httpd.conf workaround #fail

From: C. Michael Pilato <cmpilato_at_collab.net>
Date: Fri, 20 Aug 2010 01:27:11 -0700

[Warning: This matter is far from highly pertinent. One tackles strange
non-problems when in an atypical environment, such as a hotel room in CA.]

I had someone ask me about Subversion autoindex support. So, like, you
point a web browser at
http://svn.apache.org/repos/asf/subversion/site/publish/ and *pow* magically
you are now looking at the index.html inside that directory.

Clearly, this could be done with an hour or two of mod_dav_svn hackery and
some new directives there. But I was trying to come up with an httpd.conf
workaround that did the trick. Here's what I tried. (On my system, all my
Subversion repositories live inside the /repos/ Location.)

   # If this is a GET request (but not a subrequest) aimed at my
   # collection of Subversion repositories and with a trailing slash, and
   # if there exists an index.html file inside that directory, then
   # temporarily redirect the browser to the index.html file.
   RewriteEngine on
   RewriteCond %{IS_SUBREQ} false
   RewriteCond %{REQUEST_METHOD} GET
   RewriteCond %{REQUEST_URI} ^/repos/.*/$
   RewriteCond %{REQUEST_URI}index.html -U
   RewriteRule /repos/(.*)/$ /repos/$1/index.html [L,R]

The result was that for every directory in which an index.html was found,
that file was served (via a browser redirect). Yay! Unfortunately, the
redirect was transmitted for directories which had no index.html child, too.
 Boo!

Sadly, I found that despite the fact that the Apache docs say about that
"-U" test the following:

   '-U' (is existing URL, via subrequest)
   Checks whether or not TestString is a valid URL, accessible via all
   the server's currently-configured access controls for that path. This
   uses an internal subrequest to do the check, so use it with care - it
   can impact your server's performance!

In reality "validity" in this context seems to have nothing to do with
"existence". I traced the subrequest that mod_rewrite made into Subversion,
and found that it never enters mod_dav to actually perform an existence get.
 I guess I expected that the subrequest would GET all the way into
Subversion, where it would get the appropriate error code (HTTP_NOT_FOUND).
 In retrospect, I think I knew that subrequests don't behavior like
full-fledged content-fetching requests. But the documentation quoted above
is pretty misleading, at any rate, IMO.

-- 
C. Michael Pilato <cmpilato_at_collab.net>
CollabNet   <>   www.collab.net   <>   Distributed Development On Demand
Received on 2010-08-20 10:27:51 CEST

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.