Permalink
Browse files

267472 TCP/IP monitor does not display request messages properly

  • Loading branch information...
1 parent 2464c7f commit 021732f0d96268b8c9daad23236b8fc5dcbe5073 david_williams committed Mar 9, 2009
@@ -15,6 +15,7 @@ <h2>Feature Patched: org.eclipse.wst.server_core.feature.patch</h2>
<h3>Plugin(s) replaced:</h3>
<ul><li>org.eclipse.wst.internet.monitor.core</li></ul>
<p>Bug <a href='https://bugs.eclipse.org/267125'>267125</a>. TCP/IP monitor causes connections to hang</p>
+<p>Bug <a href='https://bugs.eclipse.org/267472'>267472</a>. TCP/IP monitor does not display request messages properly</p>
</body></html>
@@ -28,6 +28,7 @@ description=\
Contains fixes described in the following bugillia(s):\n\
\n\
Bug https://bugs.eclipse.org/267125 TCP/IP monitor causes connections to hang\n\
+Bug https://bugs.eclipse.org/267472 TCP/IP monitor does not display request messages properly\n\
\n\
# "copyright" property - text of the "Feature Update Copyright"
@@ -198,7 +198,15 @@ public void parseBody() throws IOException {
if (isRequest) {
if (contentLength != -1) {
+ byte[] b2 = null;
+ int b2Index = 0;
+ if (contentLength < 1024 * 1024)
+ b2 = new byte[contentLength];
byte[] b = removeFromBuffer(Math.min(buffer.length, bufferIndex + contentLength));
+ if (b2 != null) {
+ System.arraycopy(b, 0, b2, 0, b.length);
+ b2Index += b.length;
+ }
int bytesLeft = contentLength - b.length;
Trace.trace(Trace.PARSING, "[Request] bytesLeft: "+ bytesLeft);
out.write(b);
@@ -207,13 +215,20 @@ public void parseBody() throws IOException {
while (bytesLeft > 0) {
n = in.read(readBuffer, 0, Math.min(readBuffer.length, bytesLeft));
bytesLeft -= n;
+ if (b2 != null) {
+ System.arraycopy(readBuffer, 0, b2, b2Index, n);
+ b2Index += n;
+ }
out.write(readBuffer, 0, n);
Trace.trace(Trace.PARSING, "[Request] bytes read: "+ n + " bytesLeft: "+ bytesLeft);
}
- b = Messages.errorContentSize.getBytes();
- conn.addRequest(b, false);
- setHTTPBody(b);
+ // restore the byte array for display
+ if (b2 == null)
+ b2 = Messages.errorContentSize.getBytes();
+
+ conn.addRequest(b2, false);
+ setHTTPBody(b2);
} else if (transferEncoding != -1 && transferEncoding != ENCODING_IDENTITY) {
parseChunk();
}
@@ -270,7 +285,15 @@ public void parseBody() throws IOException {
// spec 4.4.3
if (contentLength != -1) {
+ byte[] b2 = null;
+ int b2Index = 0;
+ if (contentLength < 1024 * 1024)
+ b2 = new byte[contentLength];
byte[] b = removeFromBuffer(Math.min(buffer.length, bufferIndex + contentLength));
+ if (b2 != null) {
+ System.arraycopy(b, 0, b2, 0, b.length);
+ b2Index += b.length;
+ }
int bytesLeft = contentLength - b.length;
Trace.trace(Trace.PARSING,"bytesLeft: "+ bytesLeft);
out.write(b);
@@ -279,16 +302,23 @@ public void parseBody() throws IOException {
while (bytesLeft > 0) {
n = in.read(readBuffer, 0, Math.min(readBuffer.length, bytesLeft));
bytesLeft -= n;
+ if (b2 != null) {
+ System.arraycopy(readBuffer, 0, b2, b2Index, n);
+ b2Index += n;
+ }
Trace.trace(Trace.PARSING,"bytes read: "+n + " bytesLeft: "+ bytesLeft);
out.write(readBuffer, 0, n);
}
+
+ // restore the byte array for display
+ if (b2 == null)
+ b2 = Messages.errorContentSize.getBytes();
- b = Messages.errorContentSize.getBytes();
if (isRequest)
- conn.addRequest(b, false);
+ conn.addRequest(b2, false);
else
- conn.addResponse(b, false);
- setHTTPBody(b);
+ conn.addResponse(b2, false);
+ setHTTPBody(b2);
return;
}

0 comments on commit 021732f

Please sign in to comment.