remm 02/01/10 08:57:03 Modified: http11/src/test/java/org/apache/coyote/http11 TestAdapter.java http11/src/test/tests test1.txt Log: - Improve the first test. - Improve the default adapter, which will read the request body, and write it back on the output. Revision Changes Path 1.2 +30 -2 jakarta-tomcat-connectors/http11/src/test/java/org/apache/coyote/http11/TestAdapter.java Index: TestAdapter.java =================================================================== RCS file: /home/cvs/jakarta-tomcat-connectors/http11/src/test/java/org/apache/coyote/http11/TestAdapter.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- TestAdapter.java 2 Jan 2002 15:06:35 -0000 1.1 +++ TestAdapter.java 10 Jan 2002 16:57:03 -0000 1.2 @@ -59,8 +59,10 @@ package org.apache.coyote.http11; import org.apache.tomcat.util.buf.MessageBytes; +import org.apache.tomcat.util.buf.ByteChunk; import org.apache.tomcat.util.http.MimeHeaders; +import org.apache.coyote.ActionCode; import org.apache.coyote.Adapter; import org.apache.coyote.Request; import org.apache.coyote.Response; @@ -84,6 +86,8 @@ throws Exception { StringBuffer buf = new StringBuffer(); + buf.append("Request dump:"); + buf.append(CRLF); buf.append(req.method()); buf.append(" "); buf.append(req.unparsedURI()); @@ -91,8 +95,32 @@ buf.append(req.protocol()); buf.append(CRLF); - - + MimeHeaders headers = req.getMimeHeaders(); + int size = headers.size(); + for (int i = 0; i < size; i++) { + buf.append(headers.getName(i) + ": "); + buf.append(headers.getValue(i).toString()); + buf.append(CRLF); + } + + buf.append("Request body:"); + buf.append(CRLF); + + res.action(ActionCode.ACTION_ACK, null); + + ByteChunk bc = new ByteChunk(); + byte[] b = buf.toString().getBytes(); + bc.setBytes(b, 0, b.length); + res.doWrite(bc); + + int nRead = 0; + + while (nRead >= 0) { + nRead = req.doRead(bc); + if (nRead > 0) + res.doWrite(bc); + } + } 1.2 +35 -1 jakarta-tomcat-connectors/http11/src/test/tests/test1.txt Index: test1.txt =================================================================== RCS file: /home/cvs/jakarta-tomcat-connectors/http11/src/test/tests/test1.txt,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- test1.txt 2 Jan 2002 15:06:36 -0000 1.1 +++ test1.txt 10 Jan 2002 16:57:03 -0000 1.2 @@ -1,7 +1,41 @@ GET /foo HTTP/1.1 -Host: localhost +Header1: simple header +Host: random_host +Header2: this is a sample multiline header formatted + using lots of extra spaces +Header3: another + multiline + header + which + spans + six lines +Content-Length: 204 +01234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 GET /bar HTTP/1.1 +Host:foobar + + +GET /foo2 HTTP/1.1 +Host: localhost +Header4: this is a sample multiline header formatted + using lots of extra spaces +Header5: another + multiline + header + which + spans + six lines +Content-Length: 12 + +0123456789 +GET /bar2 HTTP/1.1 +Header6: another + multiline + header + which + spans + six lines Host:foobar
-- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>