You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2016/10/16 10:17:00 UTC
svn commit: r1765133 -
/tomcat/trunk/java/org/apache/coyote/http11/Http11OutputBuffer.java
Author: markt
Date: Sun Oct 16 10:17:00 2016
New Revision: 1765133
URL: http://svn.apache.org/viewvc?rev=1765133&view=rev
Log:
Simplify / remove unnecessary checks when writing status codes
Modified:
tomcat/trunk/java/org/apache/coyote/http11/Http11OutputBuffer.java
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=1765133&r1=1765132&r2=1765133&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/coyote/http11/Http11OutputBuffer.java (original)
+++ tomcat/trunk/java/org/apache/coyote/http11/Http11OutputBuffer.java Sun Oct 16 10:17:00 2016
@@ -352,7 +352,7 @@ public class Http11OutputBuffer implemen
write(Constants._404_BYTES);
break;
default:
- write(String.valueOf(status));
+ write(status);
}
headerBuffer.put(Constants.SP);
@@ -449,29 +449,18 @@ public class Http11OutputBuffer implemen
/**
- * This method will write the contents of the specified String to the
- * output stream, without filtering. This method is meant to be used to
- * write the response header.
+ * This method will write the specified integer to the output stream. This
+ * method is meant to be used to write the response header.
*
- * @param s data to be written
+ * @param value data to be written
*/
- private void write(String s) {
- if (s == null) {
- return;
- }
-
+ private void write(int value) {
// From the Tomcat 3.3 HTTP/1.0 connector
+ String s = Integer.toString(value);
int len = s.length();
checkLengthBeforeWrite(len);
for (int i = 0; i < len; i++) {
char c = s.charAt (i);
- // Note: This is clearly incorrect for many strings,
- // but is the only consistent approach within the current
- // servlet framework. It must suffice until servlet output
- // streams properly encode their output.
- if (((c <= 31) && (c != 9)) || c == 127 || c > 255) {
- c = ' ';
- }
headerBuffer.put((byte) c);
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org