Return-Path: X-Original-To: apmail-jmeter-dev-archive@minotaur.apache.org Delivered-To: apmail-jmeter-dev-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id CA973D1EE for ; Sun, 26 Aug 2012 16:10:30 +0000 (UTC) Received: (qmail 73323 invoked by uid 500); 26 Aug 2012 16:10:30 -0000 Delivered-To: apmail-jmeter-dev-archive@jmeter.apache.org Received: (qmail 73287 invoked by uid 500); 26 Aug 2012 16:10:30 -0000 Mailing-List: contact dev-help@jmeter.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@jmeter.apache.org Delivered-To: mailing list dev@jmeter.apache.org Received: (qmail 73279 invoked by uid 99); 26 Aug 2012 16:10:30 -0000 Received: from minotaur.apache.org (HELO minotaur.apache.org) (140.211.11.9) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 26 Aug 2012 16:10:30 +0000 Received: from localhost (HELO [192.168.7.246]) (127.0.0.1) (smtp-auth username milamber, mechanism plain) by minotaur.apache.org (qpsmtpd/0.29) with ESMTP; Sun, 26 Aug 2012 16:10:30 +0000 Message-ID: <503A4A69.6060900@apache.org> Date: Sun, 26 Aug 2012 17:10:17 +0100 From: Milamber Organization: Apache Software Fondation User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:10.0.6esrpre) Gecko/20120803 Firefox/10.0.6esrpre Iceape/2.7.6 MIME-Version: 1.0 To: dev@jmeter.apache.org Subject: Re: svn commit: r1376905 - /jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHC4Impl.java References: <20120824132108.D39CF23888E3@eris.apache.org> In-Reply-To: <20120824132108.D39CF23888E3@eris.apache.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Le 24/08/2012 14:21, sebb@apache.org a ecrit : > Author: sebb > Date: Fri Aug 24 13:21:08 2012 > New Revision: 1376905 > > URL: http://svn.apache.org/viewvc?rev=1376905&view=rev > Log: > The the case of getSendParameterValuesAsPostBody, encoding should be left to the entity handler > > Modified: > jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHC4Impl.java > > Modified: jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHC4Impl.java > URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHC4Impl.java?rev=1376905&r1=1376904&r2=1376905&view=diff > ============================================================================== > --- jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHC4Impl.java (original) > +++ jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHC4Impl.java Fri Aug 24 13:21:08 2012 > @@ -914,19 +914,13 @@ public class HTTPHC4Impl extends HTTPHCA > PropertyIterator args = getArguments().iterator(); > while (args.hasNext()) { > HTTPArgument arg = (HTTPArgument) args.next().getObjectValue(); > - String value; > - if (haveContentEncoding){ > - value = arg.getEncodedValue(contentEncoding); > - } else { > - value = arg.getEncodedValue(); > - } > - postBody.append(value); > + postBody.append(arg.getValue()); This update section seems introduce a regression in junit test. (missing arg encoding) [java] >>>>>>>>>>>>>>>>>>>> expected: [java] mytitle%2F%3Dmydescription+++%2F%5C [java] ==================== actual: [java] mytitle/=mydescription /\ [java] <<<<<<<<<<<<<<<<<<<< [java] URL=http://localhost:8182/test/somescript.jsp [java] F..................................... [java] There was 1 failure: [java] 1) testPostRequest_BodyFromParameterValues3(org.apache.jmeter.protocol.http.sampler.TestHTTPSamplersAgainstHttpMirrorServer)junit.framework.AssertionFailedError: arrays have different length, expected is 35, actual is 27 [java] at org.apache.jmeter.protocol.http.sampler.TestHTTPSamplersAgainstHttpMirrorServer.checkArraysHaveSameContent(TestHTTPSamplersAgainstHttpMirrorServer.java:1239) [java] at org.apache.jmeter.protocol.http.sampler.TestHTTPSamplersAgainstHttpMirrorServer.checkPostRequestBody(TestHTTPSamplersAgainstHttpMirrorServer.java:911) [java] at org.apache.jmeter.protocol.http.sampler.TestHTTPSamplersAgainstHttpMirrorServer.testPostRequest_BodyFromParameterValues(TestHTTPSamplersAgainstHttpMirrorServer.java:525) [java] at org.apache.jmeter.protocol.http.sampler.TestHTTPSamplersAgainstHttpMirrorServer.testPostRequest_BodyFromParameterValues3(TestHTTPSamplersAgainstHttpMirrorServer.java:176) [java] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [java] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) [java] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) [java] at junit.extensions.TestDecorator.basicRun(TestDecorator.java:24) [java] at junit.extensions.TestSetup$1.protect(TestSetup.java:23) [java] at junit.extensions.TestSetup.run(TestSetup.java:27) [java] at org.apache.jorphan.test.AllTests.main(AllTests.java:235) [java] > } > - ContentType contentType = > - ContentType.create(post.getFirstHeader(HTTPConstants.HEADER_CONTENT_TYPE).getValue(), contentEncoding); > - StringEntity requestEntity = new StringEntity(postBody.toString(), contentType); > + final String charset = getContentEncoding(HTTP.DEF_CONTENT_CHARSET.name()); > + // Let StringEntity perform the encoding > + StringEntity requestEntity = new StringEntity(postBody.toString(), charset); > post.setEntity(requestEntity); > - postedBody.append(postBody.toString()); // TODO OK? > + postedBody.append(postBody.toString()); > } else { > // It is a normal post request, with parameter names and values > > > > . >