JavaHL: redirect cycle detected for non-cyclic redirects

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

JavaHL: redirect cycle detected for non-cyclic redirects

Marc Strapetz-2
I have following Apache virtual host configuration which contains a
redirect:

   RedirectMatch 301 ^/svntest/(.*)$ /svntests/$1

   <Location /svntests>
     DAV svn
     SVNParentPath /misc/svntests
     ...
   </Location>

When trying to access a redirected repository from command line, this
works fine:

$ svn ls https://host/svntest/test1
Redirecting to URL 'https://host/svntests/test1':
project1/

When trying to access using JavaHL, a "Redirect cycle detected for URL"
SubversionException is thrown. Code snippet:

RemoteFactory remoteFactory = new RemoteFactory();
remoteFactory.openRemoteSession("https://host/svntest/test1", 100);

As the definition is not cyclic and retryAttempts=100 should be
sufficient, it looks like there is a JavaHL problem related to redirects?

Tested with Subversion 1.9.5

-Marc
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: JavaHL: redirect cycle detected for non-cyclic redirects

Branko Čibej
On 24.05.2017 12:19, Marc Strapetz wrote:

> I have following Apache virtual host configuration which contains a
> redirect:
>
>   RedirectMatch 301 ^/svntest/(.*)$ /svntests/$1
>
>   <Location /svntests>
>     DAV svn
>     SVNParentPath /misc/svntests
>     ...
>   </Location>
>
> When trying to access a redirected repository from command line, this
> works fine:
>
> $ svn ls https://host/svntest/test1
> Redirecting to URL 'https://host/svntests/test1':
> project1/
>
> When trying to access using JavaHL, a "Redirect cycle detected for
> URL" SubversionException is thrown. Code snippet:
>
> RemoteFactory remoteFactory = new RemoteFactory();
> remoteFactory.openRemoteSession("https://host/svntest/test1", 100);
>
> As the definition is not cyclic and retryAttempts=100 should be
> sufficient, it looks like there is a JavaHL problem related to redirects?

Could be a bug in the redirect detection logic in JavaHL. I'll take a look.

-- Brane

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: JavaHL: redirect cycle detected for non-cyclic redirects

Branko Čibej
On 24.05.2017 19:37, Branko Čibej wrote:

> On 24.05.2017 12:19, Marc Strapetz wrote:
>> I have following Apache virtual host configuration which contains a
>> redirect:
>>
>>   RedirectMatch 301 ^/svntest/(.*)$ /svntests/$1
>>
>>   <Location /svntests>
>>     DAV svn
>>     SVNParentPath /misc/svntests
>>     ...
>>   </Location>
>>
>> When trying to access a redirected repository from command line, this
>> works fine:
>>
>> $ svn ls https://host/svntest/test1
>> Redirecting to URL 'https://host/svntests/test1':
>> project1/
>>
>> When trying to access using JavaHL, a "Redirect cycle detected for
>> URL" SubversionException is thrown. Code snippet:
>>
>> RemoteFactory remoteFactory = new RemoteFactory();
>> remoteFactory.openRemoteSession("https://host/svntest/test1", 100);
>>
>> As the definition is not cyclic and retryAttempts=100 should be
>> sufficient, it looks like there is a JavaHL problem related to redirects?
> Could be a bug in the redirect detection logic in JavaHL. I'll take a look.

Can you try this patch, please?

Index: subversion/bindings/javahl/native/RemoteSession.cpp
===================================================================
--- subversion/bindings/javahl/native/RemoteSession.cpp (revision 1796083)
+++ subversion/bindings/javahl/native/RemoteSession.cpp (working copy)
@@ -214,8 +214,9 @@ RemoteSession::RemoteSession(int retryAttempts,
           cycle_detected = true;
           break;
         }
-      /* ### Shouldn't url be updated for the next attempt?
-         ### There is no real cycle if we just do the same thing twice? */
+
+      url = corrected_url;
+      corrected_url = NULL;
     }
 
   if (cycle_detected)

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: JavaHL: redirect cycle detected for non-cyclic redirects

Marc Strapetz-2
On 24.05.2017 19:59, Branko Čibej wrote:

> On 24.05.2017 19:37, Branko Čibej wrote:
>> On 24.05.2017 12:19, Marc Strapetz wrote:
>>> I have following Apache virtual host configuration which contains a
>>> redirect:
>>>
>>>   RedirectMatch 301 ^/svntest/(.*)$ /svntests/$1
>>>
>>>   <Location /svntests>
>>>     DAV svn
>>>     SVNParentPath /misc/svntests
>>>     ...
>>>   </Location>
>>>
>>> When trying to access a redirected repository from command line, this
>>> works fine:
>>>
>>> $ svn ls https://host/svntest/test1
>>> Redirecting to URL 'https://host/svntests/test1':
>>> project1/
>>>
>>> When trying to access using JavaHL, a "Redirect cycle detected for
>>> URL" SubversionException is thrown. Code snippet:
>>>
>>> RemoteFactory remoteFactory = new RemoteFactory();
>>> remoteFactory.openRemoteSession("https://host/svntest/test1", 100);
>>>
>>> As the definition is not cyclic and retryAttempts=100 should be
>>> sufficient, it looks like there is a JavaHL problem related to redirects?
>> Could be a bug in the redirect detection logic in JavaHL. I'll take a look.
>
> Can you try this patch, please?
>
> Index: subversion/bindings/javahl/native/RemoteSession.cpp
> ===================================================================
> --- subversion/bindings/javahl/native/RemoteSession.cpp (revision 1796083)
> +++ subversion/bindings/javahl/native/RemoteSession.cpp (working copy)
> @@ -214,8 +214,9 @@ RemoteSession::RemoteSession(int retryAttempts,
>            cycle_detected = true;
>            break;
>          }
> -      /* ### Shouldn't url be updated for the next attempt?
> -         ### There is no real cycle if we just do the same thing twice? */
> +
> +      url = corrected_url;
> +      corrected_url = NULL;
>      }
>
>    if (cycle_detected)

Thanks, Brane! We have applied the patch to 1.9.x branch and I can
confirm that it's working. Will it be possible to backport the patch to
1.9.x branch in the Subversion repository, too?

-Marc
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: JavaHL: redirect cycle detected for non-cyclic redirects

Branko Čibej
On 29.05.2017 10:31, Marc Strapetz wrote:

> On 24.05.2017 19:59, Branko Čibej wrote:
>> On 24.05.2017 19:37, Branko Čibej wrote:
>>> On 24.05.2017 12:19, Marc Strapetz wrote:
>>>> I have following Apache virtual host configuration which contains a
>>>> redirect:
>>>>
>>>>   RedirectMatch 301 ^/svntest/(.*)$ /svntests/$1
>>>>
>>>>   <Location /svntests>
>>>>     DAV svn
>>>>     SVNParentPath /misc/svntests
>>>>     ...
>>>>   </Location>
>>>>
>>>> When trying to access a redirected repository from command line, this
>>>> works fine:
>>>>
>>>> $ svn ls https://host/svntest/test1
>>>> Redirecting to URL 'https://host/svntests/test1':
>>>> project1/
>>>>
>>>> When trying to access using JavaHL, a "Redirect cycle detected for
>>>> URL" SubversionException is thrown. Code snippet:
>>>>
>>>> RemoteFactory remoteFactory = new RemoteFactory();
>>>> remoteFactory.openRemoteSession("https://host/svntest/test1", 100);
>>>>
>>>> As the definition is not cyclic and retryAttempts=100 should be
>>>> sufficient, it looks like there is a JavaHL problem related to
>>>> redirects?
>>> Could be a bug in the redirect detection logic in JavaHL. I'll take
>>> a look.
>>
>> Can you try this patch, please?
>>
>> Index: subversion/bindings/javahl/native/RemoteSession.cpp
>> ===================================================================
>> --- subversion/bindings/javahl/native/RemoteSession.cpp    (revision
>> 1796083)
>> +++ subversion/bindings/javahl/native/RemoteSession.cpp    (working
>> copy)
>> @@ -214,8 +214,9 @@ RemoteSession::RemoteSession(int retryAttempts,
>>            cycle_detected = true;
>>            break;
>>          }
>> -      /* ### Shouldn't url be updated for the next attempt?
>> -         ### There is no real cycle if we just do the same thing
>> twice? */
>> +
>> +      url = corrected_url;
>> +      corrected_url = NULL;
>>      }
>>
>>    if (cycle_detected)
>
> Thanks, Brane! We have applied the patch to 1.9.x branch and I can
> confirm that it's working.

Great, thanks for checking.

> Will it be possible to backport the patch to 1.9.x branch in the
> Subversion repository, too?

Yes, since there's no API change, just an implementation bug fix.

-- Brane

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: JavaHL: redirect cycle detected for non-cyclic redirects

Branko Čibej
On 29.05.2017 14:57, Branko Čibej wrote:

> On 29.05.2017 10:31, Marc Strapetz wrote:
>> On 24.05.2017 19:59, Branko Čibej wrote:
>>> On 24.05.2017 19:37, Branko Čibej wrote:
>>>> On 24.05.2017 12:19, Marc Strapetz wrote:
>>>>> I have following Apache virtual host configuration which contains a
>>>>> redirect:
>>>>>
>>>>>   RedirectMatch 301 ^/svntest/(.*)$ /svntests/$1
>>>>>
>>>>>   <Location /svntests>
>>>>>     DAV svn
>>>>>     SVNParentPath /misc/svntests
>>>>>     ...
>>>>>   </Location>
>>>>>
>>>>> When trying to access a redirected repository from command line, this
>>>>> works fine:
>>>>>
>>>>> $ svn ls https://host/svntest/test1
>>>>> Redirecting to URL 'https://host/svntests/test1':
>>>>> project1/
>>>>>
>>>>> When trying to access using JavaHL, a "Redirect cycle detected for
>>>>> URL" SubversionException is thrown. Code snippet:
>>>>>
>>>>> RemoteFactory remoteFactory = new RemoteFactory();
>>>>> remoteFactory.openRemoteSession("https://host/svntest/test1", 100);
>>>>>
>>>>> As the definition is not cyclic and retryAttempts=100 should be
>>>>> sufficient, it looks like there is a JavaHL problem related to
>>>>> redirects?
>>>> Could be a bug in the redirect detection logic in JavaHL. I'll take
>>>> a look.
>>> Can you try this patch, please?
>>>
>>> Index: subversion/bindings/javahl/native/RemoteSession.cpp
>>> ===================================================================
>>> --- subversion/bindings/javahl/native/RemoteSession.cpp    (revision
>>> 1796083)
>>> +++ subversion/bindings/javahl/native/RemoteSession.cpp    (working
>>> copy)
>>> @@ -214,8 +214,9 @@ RemoteSession::RemoteSession(int retryAttempts,
>>>            cycle_detected = true;
>>>            break;
>>>          }
>>> -      /* ### Shouldn't url be updated for the next attempt?
>>> -         ### There is no real cycle if we just do the same thing
>>> twice? */
>>> +
>>> +      url = corrected_url;
>>> +      corrected_url = NULL;
>>>      }
>>>
>>>    if (cycle_detected)
>> Thanks, Brane! We have applied the patch to 1.9.x branch and I can
>> confirm that it's working.
> Great, thanks for checking.
>
>> Will it be possible to backport the patch to 1.9.x branch in the
>> Subversion repository, too?
> Yes, since there's no API change, just an implementation bug fix.

Fixed on trunk and proposed for 1.9.x.

-- Brane
Loading...