Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
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.

git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@1702765 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
markt-asf committed Sep 13, 2015
1 parent 5d607d1 commit 707ab1c
Show file tree
Hide file tree
Showing 10 changed files with 13 additions and 411 deletions.
8 changes: 0 additions & 8 deletions java/org/apache/coyote/Constants.java
Expand Up @@ -55,14 +55,6 @@ public final class Constants {
(System.getSecurityManager() != null);


/**
* 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.
Expand Down
18 changes: 3 additions & 15 deletions java/org/apache/coyote/ajp/AjpProcessor.java
Expand Up @@ -44,7 +44,6 @@
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;
Expand Down Expand Up @@ -1389,20 +1388,9 @@ private void prepareResponse() throws IOException {

// 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
Expand Down
19 changes: 3 additions & 16 deletions java/org/apache/coyote/http11/Http11OutputBuffer.java
Expand Up @@ -26,7 +26,6 @@
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;

Expand Down Expand Up @@ -134,9 +133,6 @@ protected Http11OutputBuffer(Response response, int headerBufferSize) {
finished = false;

outputStreamOutputBuffer = new SocketOutputBuffer();

// Cause loading of HttpMessages
HttpMessages.getInstance(response.getLocale()).getMessage(200);
}


Expand Down Expand Up @@ -399,18 +395,9 @@ public void sendStatus() {

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;
Expand Down
144 changes: 0 additions & 144 deletions java/org/apache/tomcat/util/http/HttpMessages.java

This file was deleted.

78 changes: 0 additions & 78 deletions java/org/apache/tomcat/util/http/res/LocalStrings.properties

This file was deleted.

61 changes: 0 additions & 61 deletions java/org/apache/tomcat/util/http/res/LocalStrings_es.properties

This file was deleted.

0 comments on commit 707ab1c

Please sign in to comment.