Author: remy.maucherat(a)jboss.com
Date: 2008-05-28 22:05:11 -0400 (Wed, 28 May 2008)
New Revision: 646
Modified:
trunk/java/org/apache/coyote/http11/InternalAprInputBuffer.java
trunk/java/org/apache/coyote/http11/InternalInputBuffer.java
trunk/webapps/docs/changelog.xml
Log:
- Make parsing of request line more tolerant of multiple SP
and/or HT.
Modified: trunk/java/org/apache/coyote/http11/InternalAprInputBuffer.java
===================================================================
--- trunk/java/org/apache/coyote/http11/InternalAprInputBuffer.java 2008-05-29 01:37:56
UTC (rev 645)
+++ trunk/java/org/apache/coyote/http11/InternalAprInputBuffer.java 2008-05-29 02:05:11
UTC (rev 646)
@@ -441,7 +441,8 @@
throw new EOFException(sm.getString("iib.eof.error"));
}
- if (buf[pos] == Constants.SP) {
+ // Spec says single SP but it also says be tolerant of HT
+ if (buf[pos] == Constants.SP || buf[pos] == Constants.HT) {
space = true;
request.method().setBytes(buf, start, pos - start);
}
@@ -450,6 +451,20 @@
}
+ // Spec says single SP but also says be tolerant of multiple and/or HT
+ while (space) {
+ // Read new bytes if needed
+ if (pos >= lastValid) {
+ if (!fill())
+ throw new EOFException(sm.getString("iib.eof.error"));
+ }
+ if (buf[pos] == Constants.SP || buf[pos] == Constants.HT) {
+ pos++;
+ } else {
+ space = false;
+ }
+ }
+
// Mark the current buffer position
start = pos;
int end = 0;
@@ -459,7 +474,6 @@
// Reading the URI
//
- space = false;
boolean eol = false;
while (!space) {
@@ -470,7 +484,8 @@
throw new EOFException(sm.getString("iib.eof.error"));
}
- if (buf[pos] == Constants.SP) {
+ // Spec says single SP but it also says be tolerant of HT
+ if (buf[pos] == Constants.SP || buf[pos] == Constants.HT) {
space = true;
end = pos;
} else if ((buf[pos] == Constants.CR)
@@ -497,6 +512,20 @@
request.requestURI().setBytes(buf, start, end - start);
}
+ // Spec says single SP but also says be tolerant of multiple and/or HT
+ while (space) {
+ // Read new bytes if needed
+ if (pos >= lastValid) {
+ if (!fill())
+ throw new EOFException(sm.getString("iib.eof.error"));
+ }
+ if (buf[pos] == Constants.SP || buf[pos] == Constants.HT) {
+ pos++;
+ } else {
+ space = false;
+ }
+ }
+
// Mark the current buffer position
start = pos;
end = 0;
Modified: trunk/java/org/apache/coyote/http11/InternalInputBuffer.java
===================================================================
--- trunk/java/org/apache/coyote/http11/InternalInputBuffer.java 2008-05-29 01:37:56 UTC
(rev 645)
+++ trunk/java/org/apache/coyote/http11/InternalInputBuffer.java 2008-05-29 02:05:11 UTC
(rev 646)
@@ -391,7 +391,8 @@
throw new EOFException(sm.getString("iib.eof.error"));
}
- if (buf[pos] == Constants.SP) {
+ // Spec says single SP but it also says be tolerant of HT
+ if (buf[pos] == Constants.SP || buf[pos] == Constants.HT) {
space = true;
request.method().setBytes(buf, start, pos - start);
}
@@ -400,6 +401,20 @@
}
+ // Spec says single SP but also says be tolerant of multiple and/or HT
+ while (space) {
+ // Read new bytes if needed
+ if (pos >= lastValid) {
+ if (!fill())
+ throw new EOFException(sm.getString("iib.eof.error"));
+ }
+ if (buf[pos] == Constants.SP || buf[pos] == Constants.HT) {
+ pos++;
+ } else {
+ space = false;
+ }
+ }
+
// Mark the current buffer position
start = pos;
int end = 0;
@@ -409,7 +424,6 @@
// Reading the URI
//
- space = false;
boolean eol = false;
while (!space) {
@@ -420,7 +434,8 @@
throw new EOFException(sm.getString("iib.eof.error"));
}
- if (buf[pos] == Constants.SP) {
+ // Spec says single SP but it also says be tolerant of HT
+ if (buf[pos] == Constants.SP || buf[pos] == Constants.HT) {
space = true;
end = pos;
} else if ((buf[pos] == Constants.CR)
@@ -447,6 +462,20 @@
request.requestURI().setBytes(buf, start, end - start);
}
+ // Spec says single SP but also says be tolerant of multiple and/or HT
+ while (space) {
+ // Read new bytes if needed
+ if (pos >= lastValid) {
+ if (!fill())
+ throw new EOFException(sm.getString("iib.eof.error"));
+ }
+ if (buf[pos] == Constants.SP || buf[pos] == Constants.HT) {
+ pos++;
+ } else {
+ space = false;
+ }
+ }
+
// Mark the current buffer position
start = pos;
end = 0;
Modified: trunk/webapps/docs/changelog.xml
===================================================================
--- trunk/webapps/docs/changelog.xml 2008-05-29 01:37:56 UTC (rev 645)
+++ trunk/webapps/docs/changelog.xml 2008-05-29 02:05:11 UTC (rev 646)
@@ -41,6 +41,9 @@
<update>
Add JMX callbacks to refresh configuration, enable and disable all contexts.
(remm)
</update>
+ <update>
+ Add all CONFIG parameters to the cluster listener as fields. (remm)
+ </update>
</changelog>
</subsection>
<subsection name="Coyote">
@@ -57,6 +60,9 @@
Close the connection if there's an attempt to pipeline requests when using
Comet or an
asynchronous sendfile is needed. (remm)
</fix>
+ <fix>
+ <bug>42750</bug>: Make parsing of request line more tolerant of
multiple SP and/or HT. (markt)
+ </fix>
</changelog>
</subsection>
<subsection name="Jasper">
Show replies by date