Author: markt
Date: Mon Jan 29 20:25:28 2018
New Revision: 1822582
URL: http://svn.apache.org/viewvc?rev=1822582&view=rev
Log:
Align AJP and HTTP behaviour when no host information is present
- no functional change for AJP
- for HTTP use the actual server port rather than the configured value which
may be zero
Modified:
tomcat/trunk/java/org/apache/coyote/ajp/AjpProcessor.java
tomcat/trunk/java/org/apache/coyote/http11/Http11Processor.java
tomcat/trunk/webapps/docs/changelog.xml
Modified: tomcat/trunk/java/org/apache/coyote/ajp/AjpProcessor.java
URL:
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/ajp/AjpProcessor.java?rev=1822582&r1=1822581&r2=1822582&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/coyote/ajp/AjpProcessor.java (original)
+++ tomcat/trunk/java/org/apache/coyote/ajp/AjpProcessor.java Mon Jan 29
20:25:28 2018
@@ -871,7 +871,9 @@ public class AjpProcessor extends Abstra
private void parseHost(MessageBytes valueMB) {
if (valueMB == null || valueMB.isNull()) {
- // HTTP/1.0
+ // No host information (HTTP/1.0)
+ // Ensure the local port field is populated and then use it.
+ request.action(ActionCode.REQ_LOCALPORT_ATTRIBUTE, request);
request.setServerPort(request.getLocalPort());
try {
request.serverName().duplicate(request.localName());
Modified: tomcat/trunk/java/org/apache/coyote/http11/Http11Processor.java
URL:
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/Http11Processor.java?rev=1822582&r1=1822581&r2=1822582&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/coyote/http11/Http11Processor.java (original)
+++ tomcat/trunk/java/org/apache/coyote/http11/Http11Processor.java Mon Jan 29
20:25:28 2018
@@ -979,11 +979,13 @@ public class Http11Processor extends Abs
private void parseHost(MessageBytes valueMB) {
if (valueMB == null || valueMB.isNull()) {
- // HTTP/1.0
- // 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(protocol.getPort());
+ // No host information (HTTP/1.0)
+ // Ensure the local port field is populated and then use it.
+ request.action(ActionCode.REQ_LOCALPORT_ATTRIBUTE, request);
+ request.setServerPort(request.getLocalPort());
+
+ // request.serverName() will be set to the default host name by the
+ // mapper
return;
}
Modified: tomcat/trunk/webapps/docs/changelog.xml
URL:
http://svn.apache.org/viewvc/tomcat/trunk/webapps/docs/changelog.xml?rev=1822582&r1=1822581&r2=1822582&view=diff
==============================================================================
--- tomcat/trunk/webapps/docs/changelog.xml (original)
+++ tomcat/trunk/webapps/docs/changelog.xml Mon Jan 29 20:25:28 2018
@@ -119,6 +119,12 @@
may impact users who use these classes directly in their own code.
(markt)
</fix>
+ <fix>
+ When processing an HTTP 1.0 request in the HTTP connector and no host
+ information is provided in the request, obtain the server port from the
+ local port rather than the connector configuration since the configured
+ value maybe zero. (markt)
+ </fix>
</changelog>
</subsection>
<subsection name="Jasper">
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]