On 08/03/2022 04:32, Konstantin Kolinko wrote:
вт, 1 мар. 2022 г. в 18:08, <ma...@apache.org>:

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

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


The following commit(s) were added to refs/heads/9.0.x by this push:
      new e7d4ec3  Fix Response#sendRedirect() if no request context exists.
e7d4ec3 is described below

commit e7d4ec3cd0802da3898273d55f3d0496743153a5
Author: Knut Sander <knut.san...@mgm-sp.com>
AuthorDate: Thu Feb 24 18:40:16 2022 +0100

     Fix Response#sendRedirect() if no request context exists.

     If no ROOT context is defined, the context may be null in special cases, 
e.g. RewriteValve may use Response#sendRedirect() without any application 
context associated.
     In this case, the Tomcat behaviors for the context attributes 
useRelativeRedirects and sendRedirectBody are assumed, but without considering 
org.apache.catalina.STRICT_SERVLET_COMPLIANCE.
---
  java/org/apache/catalina/connector/Response.java | 9 +++++++--
  webapps/docs/changelog.xml                       | 5 +++++
  2 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/java/org/apache/catalina/connector/Response.java 
b/java/org/apache/catalina/connector/Response.java
index 0950bcb..1295922 100644
--- a/java/org/apache/catalina/connector/Response.java
+++ b/java/org/apache/catalina/connector/Response.java
@@ -1363,17 +1363,22 @@ public class Response implements HttpServletResponse {

          // Generate a temporary redirect to the specified location
          try {
+            Context context = getContext();
+            // If no ROOT context is defined, the context can be null.
+            // In this case, the default Tomcat values are assumed, but without
+            // reference to org.apache.catalina.STRICT_SERVLET_COMPLIANCE.
+            boolean reqHasContext = context == null;

I think it was meant to be (context != null) above...

Agreed. Good catch. Thanks. No sure how I missed that.

Fixed.

Mark

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

Reply via email to