Fully align parseHost
authormarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Sun, 5 Jun 2011 09:43:55 +0000 (09:43 +0000)
committermarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Sun, 5 Jun 2011 09:43:55 +0000 (09:43 +0000)
 - remove unnecessary code from BIO
 - improve comment for all

git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@1132356 13f79535-47bb-0310-9956-ffa450edef68

java/org/apache/coyote/http11/Http11AprProcessor.java
java/org/apache/coyote/http11/Http11NioProcessor.java
java/org/apache/coyote/http11/Http11Processor.java

index 583e256..5e0c52c 100644 (file)
@@ -833,8 +833,9 @@ public class Http11AprProcessor extends AbstractHttp11Processor {
 
         if (valueMB == null || valueMB.isNull()) {
             // HTTP/1.0
-            // Default is what the socket tells us. Overridden if a host is
-            // found/parsed
+            // If no host header, use the port info from the endpoint
+            // The host will be obtained lazily from the socket if required
+            // using ActionCode#REQ_LOCAL_NAME_ATTRIBUTE
             request.setServerPort(endpoint.getPort());
             return;
         }
index b717faf..3a669cf 100644 (file)
@@ -876,8 +876,9 @@ public class Http11NioProcessor extends AbstractHttp11Processor {
 
         if (valueMB == null || valueMB.isNull()) {
             // HTTP/1.0
-            // Default is what the socket tells us. Overridden if a host is
-            // found/parsed
+            // If no host header, use the port info from the endpoint
+            // The host will be obtained lazily from the socket if required
+            // using ActionCode#REQ_LOCAL_NAME_ATTRIBUTE
             request.setServerPort(endpoint.getPort());
             return;
         }
index 2ddbf65..520732e 100644 (file)
@@ -794,13 +794,10 @@ public class Http11Processor extends AbstractHttp11Processor {
 
         if (valueMB == null || valueMB.isNull()) {
             // HTTP/1.0
-            // Default is what the socket tells us. Overridden if a host is
-            // found/parsed
+            // If no host header, use the port info from the endpoint
+            // The host will be obtained lazily from the socket if required
+            // using ActionCode#REQ_LOCAL_NAME_ATTRIBUTE
             request.setServerPort(endpoint.getPort());
-            InetAddress localAddress = socket.getSocket().getLocalAddress();
-            // Setting the socket-related fields. The adapter doesn't know
-            // about socket.
-            request.serverName().setString(localAddress.getHostName());
             return;
         }