You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@subversion.apache.org by Dag-Erling Smørgrav <de...@des.no> on 2006/02/16 18:39:46 UTC

mod_dav_svn as root

I've been trying to set up mod_dav_svn directly on the server root, to
avoid repetition (I want http://svn.example.com/project/, not
http://svn.example.com/svn/project/)

The problem is that the document root also needs to contain some
regular files (favicon.ico, index.html, svnindex.* etc.), and I can't
figure out how to tell Apache to special-case them.  For instance, the
following doesn't work:

<Location />
  DAV svn
  SVNParentPath /var/lib/svn
  SVNIndexXSLT "/svnindex.xsl"
  <LimitExcept GET PROPFIND OPTIONS REPORT>
    Require valid-user
  </LimitExcept>
</Location>

<Location ~ "^/(favicon|index|svnindex)">
  DAV off
  SetHandler default-handler
  Order deny,allow
  Allow from all
</Location>

The actual repo browsing part works fine, but it can't access the
stylesheet, and tries to treat favicon.ico as a Subversion repo.

Has anyone successfully done this?

(I'm running Apache 2.0.55 on FreeBSD 7)

DES
-- 
Dag-Erling Smørgrav - des@des.no

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org


Re: mod_dav_svn as root

Posted by Dag-Erling Smørgrav <de...@des.no>.
Ryan Schmidt <su...@ryandesign.com> writes:
> I had tried using Alias and RewriteRule but it seemed that the
> Location directive took precedence. Dag-Erling, please feel free to
> try it and let us know if you get better results.

Here's a patch against Subversion 1.3.0.  Apply, recompile, reinstall,
stick the following in your apache conf before restarting:

RedirectMatch ^/$ /index.html
<Location ~ "^/(?!favicon|index|svnindex)">
  DAV svn
  SVNRootURI /
  SVNParentPath /var/lib/svn
  SVNIndexXSLT "/svnindex.xsl"
  <LimitExcept GET PROPFIND OPTIONS REPORT>
    Require valid-user
  </LimitExcept>
</Location>

(note that apachectl graceful won't do since you need to reload the
module)

The only caveat with this method is that / does not automatically
resolve into /index.html, hence the explicit redirect.

The final hunk may be redundant if dav_svn_resource_kind() never gets
called directly but only through dav_svn_get_resource().  I don't know
enough about mod_dav{,_svn} to tell, though.

DES
-- 
Dag-Erling Smørgrav - des@des.no


Re: mod_dav_svn as root

Posted by Ryan Schmidt <su...@ryandesign.com>.
On Feb 17, 2006, at 11:31, Miha Vitorovic wrote:

> How about using the mod_rewrite or something like that? You know  
> the one
> that can be used to do ugly things to URI before Apache gets to it.  
> That
> way you can make browser use the root URL, but mod_dav_svn will still
> happily use it's own path.

I had tried using Alias and RewriteRule but it seemed that the  
Location directive took precedence. Dag-Erling, please feel free to  
try it and let us know if you get better results.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

Re: mod_dav_svn as root

Posted by Miha Vitorovic <mv...@nil.si>.
des@des.no (Dag-Erling Smørgrav) wrote on 17.02.2006 11:08:40:

> des@des.no (Dag-Erling Smørgrav) writes:
> > back to the drawing board (or the mod_dav_svn source code, to figure
> > out why it doesn't work)

How about using the mod_rewrite or something like that? You know the one 
that can be used to do ugly things to URI before Apache gets to it. That 
way you can make browser use the root URL, but mod_dav_svn will still 
happily use it's own path.

Cheers,
---
  Miha Vitorovic
  Inženir v tehničnem področju
  Customer Support Engineer

   NIL Data Communications,  Tivolska cesta 48,  1000 Ljubljana,  Slovenia
   Phone +386 1 4746 500      Fax +386 1 4746 501     http://www.NIL.si

Re: mod_dav_svn as root

Posted by Dag-Erling Smørgrav <de...@des.no>.
des@des.no (Dag-Erling Smørgrav) writes:
> back to the drawing board (or the mod_dav_svn source code, to figure
> out why it doesn't work)

The following comment in subversion/mod_dav_svn/repos.c seems relevant:

  /* The URL space defined by the SVN provider is always a virtual
     space. Construct the path relative to the configured Location
     (root_path). So... the relative location is simply the URL used,
     skipping the root_path.

     Note: mod_dav has canonialized root_path. It will not have a trailing
     slash (unless it is "/").

     Note: given a URI of /something and a root of /some, then it is
           impossible to be here (and end up with "thing"). This is simply
           because we control /some and are dispatched to here for its
           URIs. We do not control /something, so we don't get here. Or,
           if we *do* control /something, then it is for THAT root.
  */

The simplest fix is probably to make root_path configurable.  I'm
working on a patch.

DES
-- 
Dag-Erling Smørgrav - des@des.no

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org


Re: mod_dav_svn as root

Posted by Dag-Erling Smørgrav <de...@des.no>.
des@des.no (Dag-Erling Smørgrav) writes:
> you didn't specify the repository...
>
> $ svn ls http://svn.example.com/project

dang, you're right, it doesn't work anyway.

svn: PROPFIND request failed on '%5E/(%3F!favicon%7Cindex%7Csvnindex)/project/!svn/vcc/default'
svn: PROPFIND of '%5E/(%3F!favicon%7Cindex%7Csvnindex)/project/!svn/vcc/default': 400 Bad Request (http://svn.example.com)

back to the drawing board (or the mod_dav_svn source code, to figure
out why it doesn't work)

DES
-- 
Dag-Erling Smørgrav - des@des.no

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org


Re: mod_dav_svn as root

Posted by Ryan Schmidt <su...@ryandesign.com>.
On Feb 17, 2006, at 09:51, Dag-Erling Smørgrav wrote:

>>> This should do it:
>>>
>>> <VirtualHost *:80>
>>> 	ServerName svn.example.com
>>> 	DocumentRoot /wherever/you/have/your/favicon/svnindex/etc
>>> 	<LocationMatch ^/(?!favicon\.ico|index\.html|svnindex\.xsl)>
>>> 		DAV svn
>>> 		SVNParentPath /var/lib/svn
>>> 		SVNIndexXSLT /svnindex.xsl
>>> 		<LimitExcept GET PROPFIND OPTIONS REPORT>
>>> 			Require valid-user
>>> 		</LimitExcept>
>>> 	</LocationMatch>
>>> </VirtualHost>
>
> Thanks!  I should have though of that.

It works for you? It really does produce the problem for me that I  
mentioned before:

>> svn: PROPFIND request failed on '%5E/(%3F!favicon%5C.ico%7Cindex% 
>> 5C.html%7Csvnindex%5C.xsl)/!svn/vcc/default'
>> svn: PROPFIND of '%5E/(%3F!favicon%5C.ico%7Cindex%5C.html% 
>> 7Csvnindex%5C.xsl)/!svn/vcc/default': 400 Bad Request (http:// 
>> svn.example.com)

Is this maybe a bug in Apache 2.2 then? I think you said you were  
using 2.0.55...


>> I think I have to retract this solution... while it works great in
>> the web browser, it acts peculiar when I try to "svn ls" anything in
>> my repository from the command line:
>>
>> $ svn ls http://svn.example.com
>
> you didn't specify the repository...
>
> $ svn ls http://svn.example.com/project

Ah, I forgot to mention that I'm using SVNPath on my lone repository,  
not SVNParentPath like you, sorry.



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org


Re: mod_dav_svn as root

Posted by Dag-Erling Smørgrav <de...@des.no>.
Ryan Schmidt <su...@ryandesign.com> writes:
> On Feb 17, 2006, at 00:59, Ryan Schmidt wrote:
>> This should do it:
>>
>> <VirtualHost *:80>
>> 	ServerName svn.example.com
>> 	DocumentRoot /wherever/you/have/your/favicon/svnindex/etc
>> 	<LocationMatch ^/(?!favicon\.ico|index\.html|svnindex\.xsl)>
>> 		DAV svn
>> 		SVNParentPath /var/lib/svn
>> 		SVNIndexXSLT /svnindex.xsl
>> 		<LimitExcept GET PROPFIND OPTIONS REPORT>
>> 			Require valid-user
>> 		</LimitExcept>
>> 	</LocationMatch>
>> </VirtualHost>

Thanks!  I should have though of that.

> I think I have to retract this solution... while it works great in
> the web browser, it acts peculiar when I try to "svn ls" anything in
> my repository from the command line:
>
> $ svn ls http://svn.example.com

you didn't specify the repository...

$ svn ls http://svn.example.com/project

DES
-- 
Dag-Erling Smørgrav - des@des.no

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org


Re: mod_dav_svn as root

Posted by Ryan Schmidt <su...@ryandesign.com>.
On Feb 17, 2006, at 00:59, Ryan Schmidt wrote:

>> The problem is that the document root also needs to contain some
>> regular files (favicon.ico, index.html, svnindex.* etc.), and I can't
>> figure out how to tell Apache to special-case them.
[snip]
>> The actual repo browsing part works fine, but it can't access the
>> stylesheet, and tries to treat favicon.ico as a Subversion repo.
>
> This should do it:
>
> <VirtualHost *:80>
> 	ServerName svn.example.com
> 	DocumentRoot /wherever/you/have/your/favicon/svnindex/etc
> 	<LocationMatch ^/(?!favicon\.ico|index\.html|svnindex\.xsl)>
> 		DAV svn
> 		SVNParentPath /var/lib/svn
> 		SVNIndexXSLT /svnindex.xsl
> 		<LimitExcept GET PROPFIND OPTIONS REPORT>
> 			Require valid-user
> 		</LimitExcept>
> 	</LocationMatch>
> </VirtualHost>

I think I have to retract this solution... while it works great in  
the web browser, it acts peculiar when I try to "svn ls" anything in  
my repository from the command line:

$ svn ls http://svn.example.com
svn: PROPFIND request failed on '%5E/(%3F!favicon%5C.ico%7Cindex% 
5C.html%7Csvnindex%5C.xsl)/!svn/vcc/default'
svn: PROPFIND of '%5E/(%3F!favicon%5C.ico%7Cindex%5C.html%7Csvnindex% 
5C.xsl)/!svn/vcc/default': 400 Bad Request (http://svn.example.com)

I'm using Subversion 1.3.0 and Apache 2.2.0 on Mac OS X 10.4.5 PPC.  
I'm fairly baffled by this behavior... I can't conceive of a  
situation in which Apache should be revealing the contents of a  
LocationMatch directive in response to any kind of request, but it  
seems that's exactly what's happening, else the Subversion client  
wouldn't know to try that kind of a (ridiculous) URL.

Perhaps the mod_dav_svn module is being told by Apache the contents  
of the LocationMatch directive, and is incorrectly believing this is  
suitable for including in a URL? I really don't know, I'm just  
guessing here. This is beginning to feel buggy.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

Re: mod_dav_svn as root

Posted by Ryan Schmidt <su...@ryandesign.com>.
On Feb 16, 2006, at 19:39, Dag-Erling Smørgrav wrote:

> The problem is that the document root also needs to contain some
> regular files (favicon.ico, index.html, svnindex.* etc.), and I can't
> figure out how to tell Apache to special-case them.  For instance, the
> following doesn't work:
>
> <Location />
>   DAV svn
>   SVNParentPath /var/lib/svn
>   SVNIndexXSLT "/svnindex.xsl"
>   <LimitExcept GET PROPFIND OPTIONS REPORT>
>     Require valid-user
>   </LimitExcept>
> </Location>
>
> <Location ~ "^/(favicon|index|svnindex)">
>   DAV off
>   SetHandler default-handler
>   Order deny,allow
>   Allow from all
> </Location>
>
> The actual repo browsing part works fine, but it can't access the
> stylesheet, and tries to treat favicon.ico as a Subversion repo.

This should do it:

<VirtualHost *:80>
	ServerName svn.example.com
	DocumentRoot /wherever/you/have/your/favicon/svnindex/etc
	<LocationMatch ^/(?!favicon\.ico|index\.html|svnindex\.xsl)>
		DAV svn
		SVNParentPath /var/lib/svn
		SVNIndexXSLT /svnindex.xsl
		<LimitExcept GET PROPFIND OPTIONS REPORT>
			Require valid-user
		</LimitExcept>
	</LocationMatch>
</VirtualHost>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org