Author: markt Date: Sun Sep 13 11:55:39 2015 New Revision: 1702765 URL: http://svn.apache.org/r1702765 Log: RFC 7230 states that clients should ignore reason phrases in HTTP/1.1 response messages. Since the reason phrase is optional, Tomcat no longer sends it. As a result the system property <code>org.apache.coyote.USE_CUSTOM_STATUS_MSG_IN_HEADER</code> is no longer used and has been removed.
Removed: tomcat/trunk/java/org/apache/tomcat/util/http/HttpMessages.java tomcat/trunk/java/org/apache/tomcat/util/http/res/ Modified: tomcat/trunk/java/org/apache/coyote/Constants.java tomcat/trunk/java/org/apache/coyote/ajp/AjpProcessor.java tomcat/trunk/java/org/apache/coyote/http11/Http11OutputBuffer.java tomcat/trunk/webapps/docs/changelog.xml tomcat/trunk/webapps/docs/config/systemprops.xml Modified: tomcat/trunk/java/org/apache/coyote/Constants.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/Constants.java?rev=1702765&r1=1702764&r2=1702765&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/coyote/Constants.java (original) +++ tomcat/trunk/java/org/apache/coyote/Constants.java Sun Sep 13 11:55:39 2015 @@ -56,14 +56,6 @@ public final class Constants { /** - * If true, custom HTTP status messages will be used in headers. - */ - public static final boolean USE_CUSTOM_STATUS_MSG_IN_HEADER = - Boolean.valueOf(System.getProperty( - "org.apache.coyote.USE_CUSTOM_STATUS_MSG_IN_HEADER", - "false")).booleanValue(); - - /** * The request attribute that is set to the value of {@code Boolean.TRUE} * if connector processing this request supports use of sendfile. */ 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=1702765&r1=1702764&r2=1702765&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/coyote/ajp/AjpProcessor.java (original) +++ tomcat/trunk/java/org/apache/coyote/ajp/AjpProcessor.java Sun Sep 13 11:55:39 2015 @@ -44,7 +44,6 @@ import org.apache.tomcat.util.ExceptionU import org.apache.tomcat.util.buf.ByteChunk; import org.apache.tomcat.util.buf.HexUtils; import org.apache.tomcat.util.buf.MessageBytes; -import org.apache.tomcat.util.http.HttpMessages; import org.apache.tomcat.util.http.MimeHeaders; import org.apache.tomcat.util.net.AbstractEndpoint; import org.apache.tomcat.util.net.AbstractEndpoint.Handler.SocketState; @@ -1389,20 +1388,9 @@ public class AjpProcessor extends Abstra // HTTP header contents responseMessage.appendInt(statusCode); - String message = null; - if (org.apache.coyote.Constants.USE_CUSTOM_STATUS_MSG_IN_HEADER && - HttpMessages.isSafeInHttpHeader(response.getMessage())) { - message = response.getMessage(); - } - if (message == null){ - message = HttpMessages.getInstance( - response.getLocale()).getMessage(response.getStatus()); - } - if (message == null) { - // mod_jk + httpd 2.x fails with a null status message - bug 45026 - message = Integer.toString(response.getStatus()); - } - tmpMB.setString(message); + // Reason phrase is optional but mod_jk + httpd 2.x fails with a null + // reason phrase - bug 45026 + tmpMB.setString(Integer.toString(response.getStatus())); responseMessage.appendBytes(tmpMB); // Special headers Modified: tomcat/trunk/java/org/apache/coyote/http11/Http11OutputBuffer.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/Http11OutputBuffer.java?rev=1702765&r1=1702764&r2=1702765&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/coyote/http11/Http11OutputBuffer.java (original) +++ tomcat/trunk/java/org/apache/coyote/http11/Http11OutputBuffer.java Sun Sep 13 11:55:39 2015 @@ -26,7 +26,6 @@ import org.apache.juli.logging.Log; import org.apache.juli.logging.LogFactory; import org.apache.tomcat.util.buf.ByteChunk; import org.apache.tomcat.util.buf.MessageBytes; -import org.apache.tomcat.util.http.HttpMessages; import org.apache.tomcat.util.net.SocketWrapperBase; import org.apache.tomcat.util.res.StringManager; @@ -134,9 +133,6 @@ public class Http11OutputBuffer implemen finished = false; outputStreamOutputBuffer = new SocketOutputBuffer(); - - // Cause loading of HttpMessages - HttpMessages.getInstance(response.getLocale()).getMessage(200); } @@ -399,18 +395,9 @@ public class Http11OutputBuffer implemen headerBuffer[pos++] = Constants.SP; - // Write message - String message = null; - if (org.apache.coyote.Constants.USE_CUSTOM_STATUS_MSG_IN_HEADER && - HttpMessages.isSafeInHttpHeader(response.getMessage())) { - message = response.getMessage(); - } - if (message == null) { - write(HttpMessages.getInstance( - response.getLocale()).getMessage(status)); - } else { - write(message); - } + // The reason phrase is optional but the space before it is not. Skip + // sending the reason phrase. Clients should ignore it (RFC 7230) and it + // just wastes bytes. headerBuffer[pos++] = Constants.CR; headerBuffer[pos++] = Constants.LF; Modified: tomcat/trunk/webapps/docs/changelog.xml URL: http://svn.apache.org/viewvc/tomcat/trunk/webapps/docs/changelog.xml?rev=1702765&r1=1702764&r2=1702765&view=diff ============================================================================== --- tomcat/trunk/webapps/docs/changelog.xml (original) +++ tomcat/trunk/webapps/docs/changelog.xml Sun Sep 13 11:55:39 2015 @@ -83,6 +83,13 @@ Based on code contributed by Numa de Montmollin and derived from code developed by Twitter and Netty. (remm) </add> + <fix> + RFC 7230 states that clients should ignore reason phrases in HTTP/1.1 + response messages. Since the reason phrase is optional, Tomcat no longer + sends it. As a result the system property + <code>org.apache.coyote.USE_CUSTOM_STATUS_MSG_IN_HEADER</code> is no + longer used and has been removed. (markt) + </fix> </changelog> </subsection> <subsection name="Tribes"> Modified: tomcat/trunk/webapps/docs/config/systemprops.xml URL: http://svn.apache.org/viewvc/tomcat/trunk/webapps/docs/config/systemprops.xml?rev=1702765&r1=1702764&r2=1702765&view=diff ============================================================================== --- tomcat/trunk/webapps/docs/config/systemprops.xml (original) +++ tomcat/trunk/webapps/docs/config/systemprops.xml Sun Sep 13 11:55:39 2015 @@ -653,15 +653,6 @@ <properties> - <property - name="org.apache.coyote. USE_CUSTOM_STATUS_MSG_IN_HEADER"><p>If this is - <code>true</code>, custom HTTP status messages will be used within HTTP - headers. If a custom message is specified that is not valid for use in an - HTTP header (as defined by RFC2616) then the custom message will be - ignored and the default message used.</p> - <p>If not specified, the default value of <code>false</code> will be used.</p> - </property> - <property name="catalina.useNaming"> <p>If this is <code>false</code> it will override the <code>useNaming</code> attribute for all <a href="context.html"> --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org