You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jmeter.apache.org by Philippe Mouawad <ph...@gmail.com> on 2012/08/24 15:32:11 UTC

Re: svn commit: r1376905 - /jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHC4Impl.java

Hello sebb,
This commit and the previous one seem strange to me.
Are you sure you're not breaking something ?

Regards
Philippe

On Fri, Aug 24, 2012 at 3:21 PM, <se...@apache.org> wrote:

> 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());
>                      }
> -                    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
>
>
>
>


-- 
Cordialement.
Philippe Mouawad.

Re: svn commit: r1376905 - /jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHC4Impl.java

Posted by sebb <se...@gmail.com>.
On 24 August 2012 14:32, Philippe Mouawad <ph...@gmail.com> wrote:
> Hello sebb,
> This commit and the previous one seem strange to me.
> Are you sure you're not breaking something ?

It looks like I have broken one of the POST unit tests.

However, I'm not sure the test makes much sense.

It ought to be possible to send an arbitrary POST body using nameless
params, but what was happening previously was that the params were
converted to www-form-encoding (space encoded as +). That only really
makes sense for content that represents a form.

> Regards
> Philippe
>
> On Fri, Aug 24, 2012 at 3:21 PM, <se...@apache.org> wrote:
>
>> 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());
>>                      }
>> -                    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
>>
>>
>>
>>
>
>
> --
> Cordialement.
> Philippe Mouawad.