You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by re...@apache.org on 2020/06/02 15:41:13 UTC

[tomcat] branch 9.0.x updated: 64493: Revert possible protocol value change

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

remm 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 e622833  64493: Revert possible protocol value change
e622833 is described below

commit e62283354ab6c6a86ba8e5e9d7c56e61f99e6a39
Author: remm <re...@apache.org>
AuthorDate: Tue Jun 2 17:40:59 2020 +0200

    64493: Revert possible protocol value change
    
    Best to avoid changes in 9.0.x, but I will keep the new behavior in 10.
    Don't reintroduce API on the ProtocolHandler itself.
---
 java/org/apache/catalina/connector/Connector.java | 18 +++++++++---------
 webapps/docs/changelog.xml                        |  4 ++++
 2 files changed, 13 insertions(+), 9 deletions(-)

diff --git a/java/org/apache/catalina/connector/Connector.java b/java/org/apache/catalina/connector/Connector.java
index d41fcb7..b22ce95 100644
--- a/java/org/apache/catalina/connector/Connector.java
+++ b/java/org/apache/catalina/connector/Connector.java
@@ -80,7 +80,6 @@ public class Connector extends LifecycleMBeanBase  {
 
 
     public Connector(String protocol) {
-        configuredProtocol = protocol;
         boolean apr = AprLifecycleListener.isAprAvailable() &&
                 AprLifecycleListener.getUseAprConnector();
         ProtocolHandler p = null;
@@ -104,7 +103,6 @@ public class Connector extends LifecycleMBeanBase  {
 
     public Connector(ProtocolHandler protocolHandler) {
         protocolHandlerClassName = protocolHandler.getClass().getName();
-        configuredProtocol = protocolHandlerClassName;
         this.protocolHandler = protocolHandler;
         // Default for Connector depends on this system property
         setThrowOnFailure(Boolean.getBoolean("org.apache.catalina.startup.EXIT_ON_INIT_FAILURE"));
@@ -250,12 +248,6 @@ public class Connector extends LifecycleMBeanBase  {
 
 
     /**
-     * Name of the protocol that was configured.
-     */
-    protected final String configuredProtocol;
-
-
-    /**
      * Coyote protocol handler.
      */
     protected final ProtocolHandler protocolHandler;
@@ -633,7 +625,15 @@ public class Connector extends LifecycleMBeanBase  {
      * @return the Coyote protocol handler in use.
      */
     public String getProtocol() {
-        return configuredProtocol;
+        boolean apr = AprLifecycleListener.getUseAprConnector();
+        if ((!apr && org.apache.coyote.http11.Http11NioProtocol.class.getName().equals(protocolHandlerClassName))
+                || (apr && org.apache.coyote.http11.Http11AprProtocol.class.getName().equals(protocolHandlerClassName))) {
+            return "HTTP/1.1";
+        } else if ((!apr && org.apache.coyote.ajp.AjpNioProtocol.class.getName().equals(protocolHandlerClassName))
+                || (apr && org.apache.coyote.ajp.AjpAprProtocol.class.getName().equals(protocolHandlerClassName))) {
+            return "AJP/1.3";
+        }
+        return protocolHandlerClassName;
     }
 
 
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index ea6547e..55e9419 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -77,6 +77,10 @@
         groups, roles and users in the <code>tomcat-users.xml</code> file.
         (fschumacher)
       </update>
+      <fix>
+        <bug>64493</bug>: Revert possible change of returned protocol
+        attribute value on the <code>Connector</code>. (remm)
+      </fix>
     </changelog>
   </subsection>
   <subsection name="Coyote">


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