billbarker 02/04/10 22:58:03 Modified: http11/src/java/org/apache/coyote/http11 Http11Processor.java Log: Multiple Issues. -- Degrade to the socket port on HTTP/1.0 requests with a Host header but no port number. -- Default to port 443 if an HTTP/1.1 request with no port header, but we are configured to be Secure. -- Remember the RemoteHost/RemoteAddr per-connection so that only one lookup is necessary (the 3.3.x Adapter recycles these, so memory is good). Revision Changes Path 1.23 +24 -5 jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11/Http11Processor.java Index: Http11Processor.java =================================================================== RCS file: /home/cvs/jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11/Http11Processor.java,v retrieving revision 1.22 retrieving revision 1.23 diff -u -r1.22 -r1.23 --- Http11Processor.java 9 Apr 2002 18:21:23 -0000 1.22 +++ Http11Processor.java 11 Apr 2002 05:58:03 -0000 1.23 @@ -222,6 +222,15 @@ */ protected Socket socket; + /** + * Remote Address associated with the current connection. + */ + protected String remoteAddr = null; + + /** + * Remote Host associated with the current connection. + */ + protected String remoteHost = null; // --------------------------------------------------------- Public Methods @@ -332,8 +341,9 @@ throws IOException { // Set the remote address - String remoteAddr = socket.getInetAddress().getHostAddress(); + remoteAddr = socket.getInetAddress().getHostAddress(); request.remoteAddr().setString(remoteAddr); + remoteHost = null; // Setting up the I/O inputBuffer.setInputStream(input); @@ -519,8 +529,9 @@ } } else if (actionCode == ActionCode.ACTION_REQ_HOST_ATTRIBUTE) { - - String remoteHost = socket.getInetAddress().getHostName(); + request.remoteAddr().setString(remoteAddr); + if( remoteHost == null ) + remoteHost = socket.getInetAddress().getHostName(); request.remoteHost().setString(remoteHost); } @@ -729,7 +740,7 @@ MessageBytes valueMB = req.getMimeHeaders().getValue("host"); ByteChunk valueBC = null; - if (valueMB == null) { + if (valueMB == null || valueMB.isNull()) { // HTTP/1.0 // Default is what the socket tells us. Overriden if a host is // found/parsed @@ -756,7 +767,15 @@ } if (colonPos < 0) { - req.setServerPort(80); + if( http11 ) { + if(sslSupport == null) // not configured Secure + req.setServerPort(80); + else + req.setServerPort(443); // if Secure, assume https + } else { + // Assume that non-HTTP/1.1 clients are broken + req.setServerPort(socket.getLocalPort()); + } req.serverName().setBytes( valueB, valueS, valueL); } else { req.serverName().setBytes( valueB, valueS, colonPos);
-- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>