You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@jakarta.apache.org by se...@apache.org on 2010/12/21 03:32:02 UTC
svn commit: r1051361 -
/jakarta/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/control/HttpMirrorThread.java
Author: sebb
Date: Tue Dec 21 02:32:01 2010
New Revision: 1051361
URL: http://svn.apache.org/viewvc?rev=1051361&view=rev
Log:
Add some debug
Modified:
jakarta/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/control/HttpMirrorThread.java
Modified: jakarta/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/control/HttpMirrorThread.java
URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/control/HttpMirrorThread.java?rev=1051361&r1=1051360&r2=1051361&view=diff
==============================================================================
--- jakarta/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/control/HttpMirrorThread.java (original)
+++ jakarta/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/control/HttpMirrorThread.java Tue Dec 21 02:32:01 2010
@@ -62,6 +62,7 @@ public class HttpMirrorThread extends Th
try {
in = new BufferedInputStream(clientSocket.getInputStream());
out = new BufferedOutputStream(clientSocket.getOutputStream());
+ log.debug("Write headers");
// The headers are written using ISO_8859_1 encoding
out.write("HTTP/1.0 200 OK".getBytes(ISO_8859_1)); //$NON-NLS-1$
out.write(CRLF);
@@ -82,6 +83,7 @@ public class HttpMirrorThread extends Th
int length = 0;
int positionOfBody = 0;
while(positionOfBody <= 0 && ((length = in.read(buffer)) != -1)) {
+ log.debug("Write body");
out.write(buffer, 0, length); // echo back
headers.append(new String(buffer, 0, length, ISO_8859_1));
// Check if we have read all the headers
@@ -120,10 +122,13 @@ public class HttpMirrorThread extends Th
int totalReadBytes = headerString.length() - positionOfBody - 2;
// We know when to stop reading, so we can allow the read method to block
+ log.debug("Reading, "+totalReadBytes+" < " +contentLength);
while((totalReadBytes < contentLength) && ((length = in.read(buffer)) != -1)) {
+ log.debug("Read bytes: "+length);
out.write(buffer, 0, length);
totalReadBytes += length;
+ log.debug("totalReadBytes: "+totalReadBytes);
}
}
else if (isChunked) {
@@ -133,6 +138,7 @@ public class HttpMirrorThread extends Th
// TODO propery implement support for chunked transfer, i.e. to
// know when we have read the whole request, and therefore allow
// the reading to block
+ log.debug("Chunked");
while(in.available() > 0 && ((length = in.read(buffer)) != -1)) {
out.write(buffer, 0, length);
}
@@ -140,10 +146,13 @@ public class HttpMirrorThread extends Th
else {
// The reqest has no body, or it has a transfer encoding we do not support.
// In either case, we read any data available
+ log.debug("Other");
while(in.available() > 0 && ((length = in.read(buffer)) != -1)) {
+ log.debug("Read bytes: "+length);
out.write(buffer, 0, length);
}
}
+ log.debug("Flush");
out.flush();
} catch (IOException e) {
log.error("", e);
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@jakarta.apache.org
For additional commands, e-mail: notifications-help@jakarta.apache.org