ASF Bugzilla – Attachment 34255 Details for
Bug 60092
View Result Tree: Add shortened version of the PUT body to sampler result.
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Add shortened PUT body to sampler result
0001-Add-shortened-version-of-the-PUT-body-to-sampler-res.patch (text/plain), 2.19 KB, created by
Felix Schumacher
on 2016-09-15 19:04:49 UTC
(
hide
)
Description:
Add shortened PUT body to sampler result
Filename:
MIME Type:
Creator:
Felix Schumacher
Created:
2016-09-15 19:04:49 UTC
Size:
2.19 KB
patch
obsolete
>From d7e8beeb1982349c103f585bbe00fb80650433ba Mon Sep 17 00:00:00 2001 >From: Felix Schumacher <felix.schumacher@internetallee.de> >Date: Thu, 15 Sep 2016 21:03:20 +0200 >Subject: [PATCH] Add shortened version of the PUT body to sampler result. > >--- > .../org/apache/jmeter/protocol/http/sampler/HTTPHC4Impl.java | 10 +++++++++- > 1 file changed, 9 insertions(+), 1 deletion(-) > >diff --git a/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHC4Impl.java b/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHC4Impl.java >index 7ce2336..8d70b19 100644 >--- a/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHC4Impl.java >+++ b/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHC4Impl.java >@@ -39,6 +39,8 @@ import java.util.regex.Pattern; > > import javax.security.auth.Subject; > >+import org.apache.commons.io.IOUtils; >+import org.apache.commons.io.input.BoundedInputStream; > import org.apache.commons.lang3.StringUtils; > import org.apache.http.Header; > import org.apache.http.HttpConnection; >@@ -137,6 +139,8 @@ import org.apache.log.Logger; > */ > public class HTTPHC4Impl extends HTTPHCAbstractImpl { > >+ private static final int MAX_BODY_RETAIN_SIZE = JMeterUtils.getPropDefault("httpclient4.max_body_retain_size", 32 * 1024); >+ > private static final Logger log = LoggingManager.getLoggerForClass(); > > /** retry count to be used (default 0); 0 = disable retries */ >@@ -1441,7 +1445,11 @@ public class HTTPHC4Impl extends HTTPHCAbstractImpl { > // our own stream, so we can return it > final HttpEntity entityEntry = entity.getEntity(); > if(entityEntry.isRepeatable()) { >- entityBody.append("<actual file content, not shown here>"); >+ entityBody.append(IOUtils.toString(new BoundedInputStream( >+ entityEntry.getContent(), MAX_BODY_RETAIN_SIZE))); >+ if (entityEntry.getContentLength() > MAX_BODY_RETAIN_SIZE) { >+ entityBody.append("<actual file content shortened>"); >+ } > } > else { // this probably cannot happen > entityBody.append("<RequestEntity was not repeatable, cannot view what was sent>"); >-- >2.7.4 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 60092
: 34255