You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by "Anil K. Vijendran" <An...@eng.sun.com> on 1999/10/26 00:56:21 UTC
Re: cvs commit: jakarta-tomcat/src/tests/share/tests/request Get.java
Post.java get.properties post.properties
Costin,
I see the following failure...
bash.exe-2.02$ ./runtest.bat
Using classpath:
\lib\tools.jar;..\classes;..\webpages\WEB-INF\classes\jsp\beans;..\xml.jar;..\jasper.jar;..\servlet.jar;..\webserver.jar;;classes;lib\moo.jar;..\..\..\jakarta-tools\projectx-tr2.jar;\lib\tools.jar;c:\jdk1.2.2\lib\tools.jar;c:\users\akv\tomcat-cvs\build\tomcat\classes
testing 18 modules
File Length Test : OK
Content Type Test : OK
File Integrity Test : OK
Welcome Test : OK
Simple Forwarding Test : OK
Forwarding With Query String Test : OK
Simple Inclusion Test : OK
File Inclusion Test : OK
Mismatch1 Test : OK
Mismatch2 Test : OK
IncludeMismatch1 Test : OK
IncludeMismatch2 Test : OK
Simple Redirect Test : OK
PrintWriterTest Test : OK
Http Date y2k Test : OK
Method GET Test : OK
POST error in 27
Expecting: HTTP/1.0 414 Request-URI Too Long
Response:
Method POST Test : FAIL -
can't run test 27 : /servlet/request.EchoServlet : 0.9 : 414
URI Request Map Test : OK
<<< FAIL >>>
Number of tests Passed: 17
Number of tests Failed: 1
complete in : 3.625 seconds
The name specified is not recognized as an
internal or external command, operable program or batch file.
Tomcat Web Server Version 2.2
Loaded configuration from: file:C:/users/akv/tomcat-cvs/build/tomcat/test/server.xml
bash.exe-2.02$
costin@hyperreal.org wrote:
> costin 99/10/25 15:46:48
>
> Modified: src/share/org/apache/tomcat/server Tag:
> TOMCAT_J2EE_10F_102199 ServerRequest.java
> src/tests/share/tests/request Tag: TOMCAT_J2EE_10F_102199
> Get.java Post.java get.properties post.properties
> Log:
> Various fixes in tests:
> - 404/403 fixed to match what tomcat returns
> - removed tests where we return HTTP0.9 error messages ( tests
> checked for HTTP/1.0 )
> - Failing tests will print what they expected and what they get (
> backport from main branch )
> - Fixed "connection reset" problem on Linux ( from main branch )
>
> Also, a small fix in ServerRequest's handling of 0.9.
>
> Revision Changes Path
> No revision
>
>
> No revision
>
>
> 1.1.1.1.2.1 +5 -4 jakarta-tomcat/src/share/org/apache/tomcat/server/ServerRequest.java
>
> Index: ServerRequest.java
> ===================================================================
> RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/server/ServerRequest.java,v
> retrieving revision 1.1.1.1
> retrieving revision 1.1.1.1.2.1
> diff -u -r1.1.1.1 -r1.1.1.1.2.1
> --- ServerRequest.java 1999/10/09 00:20:48 1.1.1.1
> +++ ServerRequest.java 1999/10/25 22:46:41 1.1.1.1.2.1
> @@ -1,7 +1,7 @@
> /*
> - * $Header: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/server/ServerRequest.java,v 1.1.1.1 1999/10/09 00:20:48 duncan Exp $
> - * $Revision: 1.1.1.1 $
> - * $Date: 1999/10/09 00:20:48 $
> + * $Header: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/server/ServerRequest.java,v 1.1.1.1.2.1 1999/10/25 22:46:41 costin Exp $
> + * $Revision: 1.1.1.1.2.1 $
> + * $Date: 1999/10/25 22:46:41 $
> *
> * ====================================================================
> *
> @@ -120,7 +120,8 @@
> return;
> }
>
> - headers.read(sis);
> + if(protocol!=null)
> + headers.read(sis);
> processCookies();
>
> contentLength = headers.getIntHeader("content-length");
>
>
>
> No revision
>
>
> No revision
>
>
> 1.2.2.1 +24 -11 jakarta-tomcat/src/tests/share/tests/request/Get.java
>
> Index: Get.java
> ===================================================================
> RCS file: /home/cvs/jakarta-tomcat/src/tests/share/tests/request/Get.java,v
> retrieving revision 1.2
> retrieving revision 1.2.2.1
> diff -u -r1.2 -r1.2.2.1
> --- Get.java 1999/10/14 23:49:01 1.2
> +++ Get.java 1999/10/25 22:46:43 1.2.2.1
> @@ -1,6 +1,6 @@
>
> /*
> - * $Id: Get.java,v 1.2 1999/10/14 23:49:01 akv Exp $
> + * $Id: Get.java,v 1.2.2.1 1999/10/25 22:46:43 costin Exp $
> */
>
> /**
> @@ -171,11 +171,18 @@
> boolean responseStatus =
> (response.indexOf(responseKey) > -1) ? true : false;
>
> - return (testCondition) ? responseStatus : ! responseStatus;
> + if( testCondition!=responseStatus) {
> + System.out.println("Get.test: unexpected result ");
> + System.out.println("Request: " + request );
> + System.out.println("Expecting: " + responseKey );
> + System.out.println("Got: " + response);
> +
> + }
> + return testCondition==responseStatus; // same as (testCondition) ? responseStatus : ! responseStatus;
> }
>
> private String dispatch(String request) {
> - String response = null;
> + String response = ""; // avoid NPE
>
> openIO();
>
> @@ -183,9 +190,9 @@
> try {
> writeRequest(request);
>
> - response = getResponse();
> + response = getResponse();
>
> - } catch (IOException ioe) {
> + } catch(IOException ioe) {
> ioe.printStackTrace();
> }
> }
> @@ -258,12 +265,18 @@
>
> if (this.debug)
> System.out.println("<--------");
> - while ((line = br.readLine()) != null) {
> - if (this.debug)
> - System.out.println("\t" + line);
> - sb.append(line);
> - sb.append('\n');
> - }
> + try {
> + while ((line = br.readLine()) != null) {
> + if (this.debug)
> + System.out.println("\t" + line);
> + sb.append(line);
> + sb.append('\n');
> + }
> + } catch(java.net.SocketException ex ) {
> + // server closed connection before reading the request.
> + // Happens on Linux - it is safe to ignore the request.
> + // System.out.println("Connection reset by peer - before full request read ");
> + }
> if (this.debug)
> System.out.println("-------->");
>
>
>
>
> 1.2.2.1 +29 -16 jakarta-tomcat/src/tests/share/tests/request/Post.java
>
> Index: Post.java
> ===================================================================
> RCS file: /home/cvs/jakarta-tomcat/src/tests/share/tests/request/Post.java,v
> retrieving revision 1.2
> retrieving revision 1.2.2.1
> diff -u -r1.2 -r1.2.2.1
> --- Post.java 1999/10/14 23:49:01 1.2
> +++ Post.java 1999/10/25 22:46:43 1.2.2.1
> @@ -1,6 +1,6 @@
>
> /*
> - * $Id: Post.java,v 1.2 1999/10/14 23:49:01 akv Exp $
> + * $Id: Post.java,v 1.2.2.1 1999/10/25 22:46:43 costin Exp $
> */
>
> /**
> @@ -91,26 +91,32 @@
>
> private boolean test(String testId) {
>
> - boolean responseStatus = dispatch(testId);
> + String response = dispatch(testId);
> String magnitude = props.getProperty("test." + testId + ".magnitude", "true");
> boolean testCondition = Boolean.valueOf(magnitude).booleanValue();
>
> - return (testCondition) ? responseStatus : ! responseStatus;
> + String responseKey = props.getProperty("test." + testId + ".response");
> + boolean responseStatus = (response.indexOf(responseKey) > -1) ? true : false;
> +
> + if( testCondition!=responseStatus) {
> + System.out.println("POST error in " + testId );
> + System.out.println("Expecting: " + responseKey);
> + System.out.println("Response: " + response);
> + }
> + return testCondition==responseStatus;
> }
>
> - private boolean dispatch(String testId) {
> + private String dispatch(String testId) {
> boolean responseStatus = false;
> -
> + String response="";
> +
> openIO();
>
> if (ready()) {
> try {
> writeRequest(testId);
> - String response = getResponse();
> + response = getResponse();
>
> - String responseKey = props.getProperty("test." + testId + ".response");
> - responseStatus =
> - (response.indexOf(responseKey) > -1) ? true : false;
> } catch (IOException ioe) {
> ioe.printStackTrace();
> }
> @@ -118,7 +124,7 @@
>
> closeIO();
>
> - return responseStatus;
> + return response;
> }
>
> private void openIO() {
> @@ -205,12 +211,19 @@
>
> if (this.debug)
> System.out.println("<--------");
> - while ((line = br.readLine()) != null) {
> - if (this.debug)
> - System.out.println("\t" + line);
> - sb.append(line);
> - sb.append('\n');
> - }
> + try {
> + while ((line = br.readLine()) != null) {
> + if (this.debug)
> + System.out.println("\t" + line);
> + sb.append(line);
> + sb.append('\n');
> + }
> + } catch(java.net.SocketException ex ) {
> + // server closed connection before reading the request.
> + // Happens on Linux - it is safe to ignore the request.
> + // System.out.println("Connection reset by peer - before full request read ");
> + }
> +
> if (this.debug)
> System.out.println("-------->");
>
>
>
>
> 1.2.2.2 +1 -1 jakarta-tomcat/src/tests/share/tests/request/get.properties
>
> Index: get.properties
> ===================================================================
> RCS file: /home/cvs/jakarta-tomcat/src/tests/share/tests/request/get.properties,v
> retrieving revision 1.2.2.1
> retrieving revision 1.2.2.2
> diff -u -r1.2.2.1 -r1.2.2.2
> --- get.properties 1999/10/25 18:38:31 1.2.2.1
> +++ get.properties 1999/10/25 22:46:45 1.2.2.2
> @@ -100,7 +100,7 @@
>
> test.19.description:/servlet/ : 1.0 : 403
> test.19.request:GET /servlet/ HTTP/1.0
> -test.19.response:HTTP/1.0 403 Forbidden
> +test.19.response:HTTP/1.0 404
> test.19.magnitude:true
>
> test.20.description:/servlet/foo : 1.0 : 404
>
>
>
> 1.2.2.2 +1 -1 jakarta-tomcat/src/tests/share/tests/request/post.properties
>
> Index: post.properties
> ===================================================================
> RCS file: /home/cvs/jakarta-tomcat/src/tests/share/tests/request/post.properties,v
> retrieving revision 1.2.2.1
> retrieving revision 1.2.2.2
> diff -u -r1.2.2.1 -r1.2.2.2
> --- post.properties 1999/10/25 18:38:32 1.2.2.1
> +++ post.properties 1999/10/25 22:46:45 1.2.2.2
> @@ -70,7 +70,7 @@
> test.8.host:Localhost
> test.8.connection:close
> test.8.content:
> -test.8.response:HTTP/1.0 403 Forbidden
> +test.8.response:HTTP/1.0 404
> test.8.magnitude:true
>
> test.10.description:/ : 0.9 : 400
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org
--
Peace, Anil +<:-)