You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@subversion.apache.org by "Pinzone Gerard (DS-1)" <GP...@aaccorp.com> on 2011/12/20 20:09:16 UTC

RewriteRule breaks slave SVN commits for 1.6.x clients only

Designation:  Non-SSA/Finmeccanica  

I was having problems performing a commit on a slave server using a 1.6.17 client, but not when using the newer 1.7.x client. This started occurring when I upgraded from the latest 1.6.x server to the 1.7.1 using the official Collabnet binaries on Linux. (I only allow communication through https: e.g., no svn:, etc.) I found the cause of the problem and I'd like to share it. Here's the link to a thread I posted about this issue:

http://subversion.op​en.collab.net/ds/vie​wMessage.do?dsForumI​d=3&dsMessageId=​437980

The problem was due to a RewriteRule on the master and/or slave:

# Redirect to remove double slash within URL-path RewriteCond %{REQUEST_URI} ^(.*)//+(.*)$ RewriteRule .* https://%{SERVER_NAME}%1/%2 [R=301,L]

Now, I could have sworn I had tested everything with all the rewrite rules disabled, but I must have missed that one. The reason I want to clear double slashes from the URL is because users frequently use their browser to obtain to the path they desire, then copy and paste it into svn to create a working copy, etc. I don't remember if double slashes had any impact other than cosmetic, but I figured it would be good practice to "clean up" the URL whenever possible.

I don't mind removing this RewriteRule from the configuration file, but I'm still wondering why this breaks ONLY slave commits and ONLY on older clients?

3.1.1001

Re: RewriteRule breaks slave SVN commits for 1.6.x clients only

Posted by Daniel Shahaf <d....@daniel.shahaf.name>.
Pinzone Gerard (DS-1) wrote on Tue, Dec 20, 2011 at 20:50:44 +0000:
> Designation:  Non-SSA/Finmeccanica  
> 
> Daniel Shahaf wrote:
> > Yeah, but you do that in three round-trips rather than two:
> >
> > GET /foo//bar//baz
> > 301 Moved Permanently
> > Location: /foo/bar//baz
> > GET /foo/bar//baz
> > 301 Moved Permanently
> > Location: /foo/bar//baz
> > GET /foo/bar/baz
> > 200 OK
> 
> Right, but I don't know another way of accomplishing it. If you know how to do it more efficiently, I'm all ears. 
> 
> 3.1.1001

I've seen this:
http://httpd.apache.org/docs/current/rewrite/flags.html#flag_n

There may or may not be better ways.  This is becoming a topic for
users@httpd.a.o (I imagine treatment of double slashes is a standard
issue there)

RE: RewriteRule breaks slave SVN commits for 1.6.x clients only

Posted by "Pinzone Gerard (DS-1)" <GP...@aaccorp.com>.
Designation:  Non-SSA/Finmeccanica  

Daniel Shahaf wrote:
> Yeah, but you do that in three round-trips rather than two:
>
> GET /foo//bar//baz
> 301 Moved Permanently
> Location: /foo/bar//baz
> GET /foo/bar//baz
> 301 Moved Permanently
> Location: /foo/bar//baz
> GET /foo/bar/baz
> 200 OK

Right, but I don't know another way of accomplishing it. If you know how to do it more efficiently, I'm all ears. 

3.1.1001

RE: RewriteRule breaks slave SVN commits for 1.6.x clients only

Posted by Daniel Shahaf <d....@daniel.shahaf.name>.

On Tue, Dec 20, 2011, at 20:28, Pinzone Gerard (DS-1) wrote:
> Designation:  Non-SSA/Finmeccanica  
> 
> Daniel Shahaf wrote:
> >> That's a solution much like cutting off a finger to get rid of a splinter. Yeah it works, but...
> >> 
> > Disagree.  Your description was that you added the RewriteRule to 
> > solve an alleged problem; I just told you that the alleged problem isn't a problem.
> 
> I didn't say multiple slashes were a (technical) problem. I said it
> would be a good practice to ensure the URLs didn't include them since
> they're superfluous. Yes, it's not a huge issue, but it's puzzling why
> this rule, which worked fine with the older 1.6.x server using both
> 1.6.x and 1.7.x clients, would give the 1.7.x server grief ONLY when
> an older 1.6.x client is used and ONLY when committing to the slave
> server, but not the master.
> 

I would also like to know what causes the issue you see with 1.6.x
clients, but I don't have time to investigate it right now.  Sorry, and
if you find what causes it please let us know.  Thanks.

> >>> (And, by the way, your RewriteRule is less than ideal; it causes a
> >> repeated request for each doubled slash: http://foo/bar/////baz)
> >> 
> >> How so?  I thought the plus sign after the second slash will capture one or more slashes?
> >> Could you provide a revised expression?
> > 
> > You're right, but consider: http://host/foo//bar//baz
> 
> Yes...but in that case, repeating the request isn't a bug it's a feature. I'd want http://host/foo//bar//baz to become http://host/foo/bar/baz

Yeah, but you do that in three round-trips rather than two:

GET /foo//bar//baz
301 Moved Permanently
Location: /foo/bar//baz
GET /foo/bar//baz
301 Moved Permanently
Location: /foo/bar//baz
GET /foo/bar/baz
200 OK

RE: RewriteRule breaks slave SVN commits for 1.6.x clients only

Posted by "Pinzone Gerard (DS-1)" <GP...@aaccorp.com>.
Designation:  Non-SSA/Finmeccanica  

Daniel Shahaf wrote:
> Sure, knowing exactly what build you used is relevant information.
>
> It's just the adjective "official" that caught my eye.

Thank you for clearing up that bit of minutia.

>> That's a solution much like cutting off a finger to get rid of a splinter. Yeah it works, but...
>> 
> Disagree.  Your description was that you added the RewriteRule to 
> solve an alleged problem; I just told you that the alleged problem isn't a problem.

I didn't say multiple slashes were a (technical) problem. I said it would be a good practice to ensure the URLs didn't include them since they're superfluous. Yes, it's not a huge issue, but it's puzzling why this rule, which worked fine with the older 1.6.x server using both 1.6.x and 1.7.x clients, would give the 1.7.x server grief ONLY when an older 1.6.x client is used and ONLY when committing to the slave server, but not the master.

>>> (And, by the way, your RewriteRule is less than ideal; it causes a
>> repeated request for each doubled slash: http://foo/bar/////baz)
>> 
>> How so?  I thought the plus sign after the second slash will capture one or more slashes?
>> Could you provide a revised expression?
> 
> You're right, but consider: http://host/foo//bar//baz

Yes...but in that case, repeating the request isn't a bug it's a feature. I'd want http://host/foo//bar//baz to become http://host/foo/bar/baz

>> I stated that this started happening "when I upgraded from the latest 
>> 1.6.x server to the 1.7.1" one. Both master and slave servers were 
>> upgraded simultaneously.
>
> You didn't mention this, AFAIK.
> 
> (And, BTW, master's version should always be ≥ slave's version.)

When I stated that I had upgraded from "latest 1.6.x server to the 1.7.1," I felt it was implied that I meant both servers. If that was confusing for anyone, I apologize.

3.1.1001

Re: RewriteRule breaks slave SVN commits for 1.6.x clients only

Posted by Daniel Shahaf <d....@daniel.shahaf.name>.
Pinzone Gerard (DS-1) wrote on Tue, Dec 20, 2011 at 19:52:04 +0000:
> Designation:  Non-SSA/Finmeccanica  
> 
> Daniel Shahaf wrote:
> 
> > The Apache Subversion Project does not release binaries, official or otherwise.  CollabNet, Inc. is > one of several third parties who build and release binaries of our software.
> 
> Just letting everyone know what binaries I was using incase this
> behavior is unique to their configuration.
> 

Sure, knowing exactly what build you used is relevant information.

It's just the adjective "official" that caught my eye.

> >> The problem was due to a RewriteRule on the master and/or slave:
> >> 
> >> # Redirect to remove double slash within URL-path RewriteCond 
> >> %{REQUEST_URI} ^(.*)//+(.*)$ RewriteRule .*
> >> https://%{SERVER_NAME}%1/%2 [R=301,L]
> >>
> >> ...
> >> 
> >> I don't mind removing this RewriteRule from the configuration file,
> >
> > Seems like that's a solution then.
> 
> That's a solution much like cutting off a finger to get rid of a splinter. Yeah it works, but...
> 

Disagree.  Your description was that you added the RewriteRule to solve
an alleged problem; I just told you that the alleged problem isn't
a problem.

> > (And, by the way, your RewriteRule is less than ideal; it causes a 
> > repeated request for each doubled slash: http://foo/bar/////baz)
> 
> How so?  I thought the plus sign after the second slash will capture one or more slashes? Could you provide a revised expression?
> 

You're right, but consider: http://host/foo//bar//baz

> >> but I'm still wondering why this breaks ONLY slave commits and ONLY 
> >> on older clients?
> >
> > Don't know.  You haven't said what version the master server runs, though.
> 
> I stated that this started happening "when I upgraded from the latest
> 1.6.x server to the 1.7.1" one. Both master and slave servers were
> upgraded simultaneously.

You didn't mention this, AFAIK.

(And, BTW, master's version should always be ≥ slave's version.)

> In fact, they're now at 1.7.2, but the issue persists.
> 
> 3.1.1001

RE: RewriteRule breaks slave SVN commits for 1.6.x clients only

Posted by "Pinzone Gerard (DS-1)" <GP...@aaccorp.com>.
Designation:  Non-SSA/Finmeccanica  

Daniel Shahaf wrote:

> The Apache Subversion Project does not release binaries, official or otherwise.  CollabNet, Inc. is > one of several third parties who build and release binaries of our software.

Just letting everyone know what binaries I was using incase this behavior is unique to their configuration.

>> The problem was due to a RewriteRule on the master and/or slave:
>> 
>> # Redirect to remove double slash within URL-path RewriteCond 
>> %{REQUEST_URI} ^(.*)//+(.*)$ RewriteRule .*
>> https://%{SERVER_NAME}%1/%2 [R=301,L]
>>
>> ...
>> 
>> I don't mind removing this RewriteRule from the configuration file,
>
> Seems like that's a solution then.

That's a solution much like cutting off a finger to get rid of a splinter. Yeah it works, but...

> (And, by the way, your RewriteRule is less than ideal; it causes a 
> repeated request for each doubled slash: http://foo/bar/////baz)

How so?  I thought the plus sign after the second slash will capture one or more slashes? Could you provide a revised expression?

>> but I'm still wondering why this breaks ONLY slave commits and ONLY 
>> on older clients?
>
> Don't know.  You haven't said what version the master server runs, though.

I stated that this started happening "when I upgraded from the latest 1.6.x server to the 1.7.1" one. Both master and slave servers were upgraded simultaneously. In fact, they're now at 1.7.2, but the issue persists.

3.1.1001

Re: RewriteRule breaks slave SVN commits for 1.6.x clients only

Posted by Daniel Shahaf <d....@daniel.shahaf.name>.
Pinzone Gerard (DS-1) wrote on Tue, Dec 20, 2011 at 19:09:16 +0000:
> Designation:  Non-SSA/Finmeccanica  
> 
> I was having problems performing a commit on a slave server using
> a 1.6.17 client, but not when using the newer 1.7.x client. This
> started occurring when I upgraded from the latest 1.6.x server to the
> 1.7.1 using the official Collabnet binaries on Linux. (I only allow

The Apache Subversion Project does not release binaries, official or
otherwise.  CollabNet, Inc. is one of several third parties who build
and release binaries of our software.

> communication through https: e.g., no svn:, etc.) I found the cause of
> the problem and I'd like to share it. Here's the link to a thread
> I posted about this issue:
> 
> http://subversion.op​en.collab.net/ds/vie​wMessage.do?dsForumI​d=3&dsMessageId=​437980

(your URL is broken; it embeds U+200B ZERO WIDTH SPACE characters)

> 
> The problem was due to a RewriteRule on the master and/or slave:
> 
> # Redirect to remove double slash within URL-path RewriteCond
> %{REQUEST_URI} ^(.*)//+(.*)$ RewriteRule .*
> https://%{SERVER_NAME}%1/%2 [R=301,L]
> 
> Now, I could have sworn I had tested everything with all the rewrite
> rules disabled, but I must have missed that one. The reason I want to
> clear double slashes from the URL is because users frequently use
> their browser to obtain to the path they desire, then copy and paste
> it into svn to create a working copy, etc. I don't remember if double
> slashes had any impact other than cosmetic, but I figured it would be

Indeed, they are cosmetic.  Double URLs are removed by the client before
they are passed to the libsvn_client library.

> good practice to "clean up" the URL whenever possible.
> 
> I don't mind removing this RewriteRule from the configuration file,

Seems like like that's a solution then.  (And, by the way, your
RewriteRule is less than ideal; it causes a repeated request for each
doubled slash: http://foo/bar/////baz)

> but I'm still wondering why this breaks ONLY slave commits and ONLY on
> older clients?
> 
> 3.1.1001

Don't know.  You haven't said what version the master server runs,
though.