267472 TCP/IP monitor does not display request messages properly
diff --git a/features/org.eclipse.wst.server_core.feature.patch/buildnotes_org.eclipse.wst.server_core.feature.patch.html b/features/org.eclipse.wst.server_core.feature.patch/buildnotes_org.eclipse.wst.server_core.feature.patch.html
index 49ec8db..eafb836 100644
--- a/features/org.eclipse.wst.server_core.feature.patch/buildnotes_org.eclipse.wst.server_core.feature.patch.html
+++ b/features/org.eclipse.wst.server_core.feature.patch/buildnotes_org.eclipse.wst.server_core.feature.patch.html
@@ -15,6 +15,7 @@
<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>
\ No newline at end of file
diff --git a/features/org.eclipse.wst.server_core.feature.patch/feature.properties b/features/org.eclipse.wst.server_core.feature.patch/feature.properties
index 0f976d8..0ffc7d0 100644
--- a/features/org.eclipse.wst.server_core.feature.patch/feature.properties
+++ b/features/org.eclipse.wst.server_core.feature.patch/feature.properties
@@ -28,6 +28,7 @@
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"
diff --git a/plugins/org.eclipse.wst.internet.monitor.core/monitorcore/org/eclipse/wst/internet/monitor/core/internal/http/HTTPThread.java b/plugins/org.eclipse.wst.internet.monitor.core/monitorcore/org/eclipse/wst/internet/monitor/core/internal/http/HTTPThread.java
index 503bb68..2acbbe1 100644
--- a/plugins/org.eclipse.wst.internet.monitor.core/monitorcore/org/eclipse/wst/internet/monitor/core/internal/http/HTTPThread.java
+++ b/plugins/org.eclipse.wst.internet.monitor.core/monitorcore/org/eclipse/wst/internet/monitor/core/internal/http/HTTPThread.java
@@ -198,7 +198,15 @@
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 @@
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 @@
// 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 @@
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;
}