costin 01/01/22 21:08:40
Modified: src/admin/WEB-INF admin.tld
src/share/org/apache/tomcat/core Response.java
src/share/org/apache/tomcat/modules/config
PolicyInterceptor.java
src/share/org/apache/tomcat/modules/server Http10.java
Http10Interceptor.java
src/share/org/apache/tomcat/util/test DefaultMatcher.java
src/tests/webpages/WEB-INF test-tomcat.xml
Log:
2 fixes in the Http implementation:
- do case-sensitive compare for the http method ( GET works, get doesn't )
- right HTTP 0.9 support
Also, a fix in the matcher ( the responseCode is not matched, needed to
deal with 0.9 requests ).
I also commented out or changed a number of tests ( POST doesn't exist
in 0.9, so need to add the protocol ).
Right now all but one tests are passing.
The failing test works fine with JspInterceptor ( if useJspServlet="false"
is used ), but fails with JspServlet.
( the current default is to use JspServlet, in order to test and make sure
it is supported and works fine ).
The failing test is test/jsp/classTest.jsp, with the error:
java.lang.IllegalAccessError: try to access class
jsp/_0002fjsp_0002fclassTest_0002ejspclassTest_jsp_0$JSPTest$Inner from class
jsp/_0002fjsp_0002fclassTest_0002ejspclassTest_jsp_0
Revision Changes Path
1.7 +2 -1 jakarta-tomcat/src/admin/WEB-INF/admin.tld
Index: admin.tld
===================================================================
RCS file: /home/cvs/jakarta-tomcat/src/admin/WEB-INF/admin.tld,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- admin.tld 2001/01/21 20:10:37 1.6
+++ admin.tld 2001/01/23 05:08:37 1.7
@@ -20,7 +20,8 @@
<tagclass>tadm.TomcatAdmin</tagclass>
<teiclass>tadm.TomcatAdminTEI</teiclass>
<info>
- Admin
+ The admin tag will perform various tomcat admin tasks. It'll also
+ make available the "cm" and "ctx" variables.
</info>
<attribute>
<name>action</name>
1.47 +0 -2 jakarta-tomcat/src/share/org/apache/tomcat/core/Response.java
Index: Response.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/core/Response.java,v
retrieving revision 1.46
retrieving revision 1.47
diff -u -r1.46 -r1.47
--- Response.java 2000/12/30 07:54:12 1.46
+++ Response.java 2001/01/23 05:08:38 1.47
@@ -349,8 +349,6 @@
*/
public void notifyEndHeaders() throws IOException {
commited=true;
- if(request.protocol().isNull()) // HTTP/0.9
- return;
// let CM notify interceptors and give a chance to fix
// the headers
1.4 +2 -2
jakarta-tomcat/src/share/org/apache/tomcat/modules/config/PolicyInterceptor.java
Index: PolicyInterceptor.java
===================================================================
RCS file:
/home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/modules/config/PolicyInterceptor.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- PolicyInterceptor.java 2001/01/08 12:15:22 1.3
+++ PolicyInterceptor.java 2001/01/23 05:08:38 1.4
@@ -72,8 +72,8 @@
* Set policy-based access to tomcat.
* Must be hooked before class loader setter.
* The context will have a single protection domain, pointing to the doc root.
- * That will include all classes loaded that belong to the context ( jsps,
WEB-INF/classes,
- * WEB-INF/lib/
+ * That will include all classes loaded that belong to the context
+ * ( jsps, WEB-INF/classes, WEB-INF/lib/
*
* @author Glenn Nielsen
* @author [EMAIL PROTECTED]
1.7 +9 -7
jakarta-tomcat/src/share/org/apache/tomcat/modules/server/Http10.java
Index: Http10.java
===================================================================
RCS file:
/home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/modules/server/Http10.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- Http10.java 2000/12/30 08:26:45 1.6
+++ Http10.java 2001/01/23 05:08:39 1.7
@@ -259,16 +259,18 @@
methodMB.setBytes( buf, startMethod, endMethod - startMethod );
// optimization - detect common strings, no allocations
- if( buf[startMethod] == 'g' ||
- buf[startMethod] == 'G') {
- if( methodMB.equalsIgnoreCase( "get" ))
+ // buf[startMethod] == 'g' ||, ignoreCase
+
+ // the idea is that we don't allocate new strings - but set
+ // to constants. ( probably not needed, it's has a tiny impact )
+ if( buf[startMethod] == 'G') {
+ if( methodMB.equals( "GET" ))
methodMB.setString("GET");
}
- if( buf[startMethod] == 'p' ||
- buf[startMethod] == 'P' ) {
- if( methodMB.equalsIgnoreCase( "post" ))
+ if( buf[startMethod] == 'P' ) {
+ if( methodMB.equals( "POST" ))
methodMB.setString("POST");
- if( methodMB.equalsIgnoreCase( "put" ))
+ if( methodMB.equals( "PUT" ))
methodMB.setString("PUT");
}
1.12 +4 -0
jakarta-tomcat/src/share/org/apache/tomcat/modules/server/Http10Interceptor.java
Index: Http10Interceptor.java
===================================================================
RCS file:
/home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/modules/server/Http10Interceptor.java,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- Http10Interceptor.java 2000/12/30 08:26:46 1.11
+++ Http10Interceptor.java 2001/01/23 05:08:39 1.12
@@ -307,6 +307,10 @@
public void endHeaders() throws IOException {
super.endHeaders();
+ if(request.protocol().isNull() ||
+ request.protocol().equals("") ) // HTTP/0.9
+ return;
+
http.sendStatus( status, HttpMessages.getMessage( status ));
http.sendHeaders( getMimeHeaders() );
}
1.5 +1 -1
jakarta-tomcat/src/share/org/apache/tomcat/util/test/DefaultMatcher.java
Index: DefaultMatcher.java
===================================================================
RCS file:
/home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/util/test/DefaultMatcher.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- DefaultMatcher.java 2001/01/22 16:42:12 1.4
+++ DefaultMatcher.java 2001/01/23 05:08:40 1.5
@@ -83,7 +83,7 @@
Vector headerVector=new Vector(); // workaround for introspection problems
Hashtable expectHeaders=new Hashtable();
// Match request line
- String returnCode="";
+ String returnCode=null;
String description;
int debug;
1.7 +22 -8 jakarta-tomcat/src/tests/webpages/WEB-INF/test-tomcat.xml
Index: test-tomcat.xml
===================================================================
RCS file: /home/cvs/jakarta-tomcat/src/tests/webpages/WEB-INF/test-tomcat.xml,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- test-tomcat.xml 2001/01/22 06:12:13 1.6
+++ test-tomcat.xml 2001/01/23 05:08:40 1.7
@@ -540,8 +540,12 @@
</target>
+ <target name="http09" depends="init">
+ <echo message="Testing HTTP 0.9 compatibility"/>
+ </target>
+
<target name="get" depends="init">
<!-- hit unavailable servlet 1st time -->
<gtest request="GET /test/servlet/Unavailable HTTP/1.0"
@@ -556,9 +560,15 @@
returnCode="${http.protocol} 400"
responseMatch="Wrong data"
/>
+
+ <gtest description="HTTP 0.9 can't return a response code"
+ request="GET /test/request/uri/does/not/exist"
+ returnCode="404" magnitude="false"
+ />
- <gtest request="GET /test/request/uri/does/not/exist"
- returnCode="404"
+ <gtest description="HTTP 0.9, check the body for 404"
+ request="GET /test/request/uri/does/not/exist"
+ responseMatch="404"
/>
<gtest request="GET /test/request/uri/does/not/exist HTTP/1.0"
@@ -722,35 +732,39 @@
returnCode="${http.protocol} 404"
/>
- <gtest request="POST /test/"
+ <gtest description="HTTP0.9 doesn't have a POST method"
+ request="POST /test/"
content=""
returnCode="${http.protocol} 400"
+ magnitude="false"
/>
- <gtest request="POST /test/servlet/request.EchoServlet"
+ <gtest request="POST /test/servlet/request.EchoServlet HTTP/1.0"
content="name=lightness of being"
returnCode="${http.protocol} 200"
/>
- <gtest request="POST /test/servlet/request.EchoServlet"
+ <gtest request="POST /test/servlet/request.EchoServlet HTTP/1.0"
content="name=lightness of being,,,,,,,....###///&&@@@@@***"
returnCode="${http.protocol} 200"
/>
- <gtest request="POST /test/servlet/request.EchoServlet"
+ <gtest request="POST /test/servlet/request.EchoServlet HTTP/1.0"
content="name=lightness of
being,,,,,,,....###///&&&&@@@@@***"
returnCode="${http.protocol} 200"
/>
- <gtest request="POST
\/test/servlet/request.EchoServlet?name=sun&age=2000"
+ <gtest request="POST /test/servlet/request.EchoServlet?name=sun&age=2000
HTTP/1.0"
content="name=lightness of being,,,,,,,....###///&@@@@@***"
returnCode="${http.protocol} 200"
/>
- <gtest request="POST \"
+ <!-- I have no idea what this should return -
+ <gtest request="POST \ HTTP/1.0"
content="name=lightness of being"
returnCode="Error: 400"
/>
+ -->
<gtest request="POST /test/servlet/request.EchoServlet HTTP/1.0"
content="name=lightness of being"
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]