You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2023/01/27 13:50:36 UTC

[tomcat] 05/05: Redirect no longer required for root mapping

This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tomcat.git

commit ce8621750e4f74229bffa7e42e648523b91b91de
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Fri Jan 27 12:57:39 2023 +0000

    Redirect no longer required for root mapping
---
 .../servlet/annotation/TestServletSecurityMappings.java        | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/test/jakarta/servlet/annotation/TestServletSecurityMappings.java b/test/jakarta/servlet/annotation/TestServletSecurityMappings.java
index 60440ea0fe..e438ae563e 100644
--- a/test/jakarta/servlet/annotation/TestServletSecurityMappings.java
+++ b/test/jakarta/servlet/annotation/TestServletSecurityMappings.java
@@ -118,14 +118,10 @@ public class TestServletSecurityMappings extends TomcatBaseTest {
 
         // Root
         rc = getUrl("http://localhost:" + getPort() + "/test", bc, false);
-        if (redirectContextRoot) {
-            Assert.assertEquals(302, rc);
+        if (secureRoot || secureDefault) {
+            Assert.assertEquals(403, rc);
         } else {
-            if (secureRoot || secureDefault) {
-                Assert.assertEquals(403, rc);
-            } else {
-                Assert.assertEquals(200, rc);
-            }
+            Assert.assertEquals(200, rc);
         }
     }
 


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Re: [tomcat] 05/05: Redirect no longer required for root mapping

Posted by Mark Thomas <ma...@apache.org>.
On 27/01/2023 16:19, Mark Thomas wrote:
> On 27/01/2023 14:11, Rémy Maucherat wrote:
>> On Fri, Jan 27, 2023 at 2:51 PM <ma...@apache.org> wrote:
>>>
>>> This is an automated email from the ASF dual-hosted git repository.
>>>
>>> markt pushed a commit to branch main
>>> in repository https://gitbox.apache.org/repos/asf/tomcat.git
>>>
>>> commit ce8621750e4f74229bffa7e42e648523b91b91de
>>> Author: Mark Thomas <ma...@apache.org>
>>> AuthorDate: Fri Jan 27 12:57:39 2023 +0000
>>>
>>>      Redirect no longer required for root mapping
>>
>> But this would break directory listing for the webapp root right ?
> 
> In the case where a servlet is mapped to the context root, yes. There 
> would be no way to pass a request to '/' to the default servlet.
> 
> Note that ROOT already effecively behaved like this.

Thinking about this again, that isn't quite right.

Mapping a servlet to the context root blocks directory listings at the 
context root for all contexts prior to this change. I believe the only 
impact of this change is that when /context-root is requested and a 
Servlet is mapped to the context root there is no redirect to 
/context-root/ before the request is passed to the Servlet.

Mark

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Re: [tomcat] 05/05: Redirect no longer required for root mapping

Posted by Mark Thomas <ma...@apache.org>.
On 27/01/2023 14:11, Rémy Maucherat wrote:
> On Fri, Jan 27, 2023 at 2:51 PM <ma...@apache.org> wrote:
>>
>> This is an automated email from the ASF dual-hosted git repository.
>>
>> markt pushed a commit to branch main
>> in repository https://gitbox.apache.org/repos/asf/tomcat.git
>>
>> commit ce8621750e4f74229bffa7e42e648523b91b91de
>> Author: Mark Thomas <ma...@apache.org>
>> AuthorDate: Fri Jan 27 12:57:39 2023 +0000
>>
>>      Redirect no longer required for root mapping
> 
> But this would break directory listing for the webapp root right ?

In the case where a servlet is mapped to the context root, yes. There 
would be no way to pass a request to '/' to the default servlet.

Note that ROOT already effecively behaved like this.

There is plenty of time to re-raise this with the Jakarta Servlet 
project if we wish. This was an area where the various containers 
weren't consistent so there may be scope to opt for a different solution.

Mark

> 
> Rémy
> 
>> ---
>>   .../servlet/annotation/TestServletSecurityMappings.java        | 10 +++-------
>>   1 file changed, 3 insertions(+), 7 deletions(-)
>>
>> diff --git a/test/jakarta/servlet/annotation/TestServletSecurityMappings.java b/test/jakarta/servlet/annotation/TestServletSecurityMappings.java
>> index 60440ea0fe..e438ae563e 100644
>> --- a/test/jakarta/servlet/annotation/TestServletSecurityMappings.java
>> +++ b/test/jakarta/servlet/annotation/TestServletSecurityMappings.java
>> @@ -118,14 +118,10 @@ public class TestServletSecurityMappings extends TomcatBaseTest {
>>
>>           // Root
>>           rc = getUrl("http://localhost:" + getPort() + "/test", bc, false);
>> -        if (redirectContextRoot) {
>> -            Assert.assertEquals(302, rc);
>> +        if (secureRoot || secureDefault) {
>> +            Assert.assertEquals(403, rc);
>>           } else {
>> -            if (secureRoot || secureDefault) {
>> -                Assert.assertEquals(403, rc);
>> -            } else {
>> -                Assert.assertEquals(200, rc);
>> -            }
>> +            Assert.assertEquals(200, rc);
>>           }
>>       }
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: dev-help@tomcat.apache.org
>>
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: dev-help@tomcat.apache.org
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Re: [tomcat] 05/05: Redirect no longer required for root mapping

Posted by Rémy Maucherat <re...@apache.org>.
On Fri, Jan 27, 2023 at 2:51 PM <ma...@apache.org> wrote:
>
> This is an automated email from the ASF dual-hosted git repository.
>
> markt pushed a commit to branch main
> in repository https://gitbox.apache.org/repos/asf/tomcat.git
>
> commit ce8621750e4f74229bffa7e42e648523b91b91de
> Author: Mark Thomas <ma...@apache.org>
> AuthorDate: Fri Jan 27 12:57:39 2023 +0000
>
>     Redirect no longer required for root mapping

But this would break directory listing for the webapp root right ?

Rémy

> ---
>  .../servlet/annotation/TestServletSecurityMappings.java        | 10 +++-------
>  1 file changed, 3 insertions(+), 7 deletions(-)
>
> diff --git a/test/jakarta/servlet/annotation/TestServletSecurityMappings.java b/test/jakarta/servlet/annotation/TestServletSecurityMappings.java
> index 60440ea0fe..e438ae563e 100644
> --- a/test/jakarta/servlet/annotation/TestServletSecurityMappings.java
> +++ b/test/jakarta/servlet/annotation/TestServletSecurityMappings.java
> @@ -118,14 +118,10 @@ public class TestServletSecurityMappings extends TomcatBaseTest {
>
>          // Root
>          rc = getUrl("http://localhost:" + getPort() + "/test", bc, false);
> -        if (redirectContextRoot) {
> -            Assert.assertEquals(302, rc);
> +        if (secureRoot || secureDefault) {
> +            Assert.assertEquals(403, rc);
>          } else {
> -            if (secureRoot || secureDefault) {
> -                Assert.assertEquals(403, rc);
> -            } else {
> -                Assert.assertEquals(200, rc);
> -            }
> +            Assert.assertEquals(200, rc);
>          }
>      }
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: dev-help@tomcat.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org