jmeter-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sebb <seb...@gmail.com>
Subject Re: svn commit: r1511125 - in /jmeter/trunk: src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHC3Impl.java src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHC4Impl.java xdocs/changes.xml
Date Wed, 07 Aug 2013 13:57:14 GMT
On 7 August 2013 13:56, Philippe Mouawad <philippe.mouawad@gmail.com> wrote:
> Hello sebb,
>
> I don't think so as for example:
>
> http://localhost:8080/?%5B%5D!@$%^*()#
> Result => http://localhost:8080/?%5B%5D%21%40%24%25%5E*%28%29
>
>
> http://localhost:8080/?%25%5B%5D!@$%^*()#
> Result => http://localhost:8080/?%25%5B%5D%21%40%24%25%5E*%28%29
>

These examples only use % after the ? i.e. as part of the query string.
AFAIK query strings are allowed to contain % characters, so they don't
get double-encoded by the HC UriBuilder / URLEncodedUtils

If % occurs elsewhere, it will be double-encoded.

> As you can see no double encode or am I missing something ?
>
> On Wed, Aug 7, 2013 at 12:44 AM, sebb <sebbaz@gmail.com> wrote:
>
>> On 6 August 2013 22:30,  <pmouawad@apache.org> wrote:
>> > Author: pmouawad
>> > Date: Tue Aug  6 21:30:55 2013
>> > New Revision: 1511125
>> >
>> > URL: http://svn.apache.org/r1511125
>> > Log:
>> > Bug 54482 - HC fails to follow redirects with non-encoded chars
>> > Bugzilla Id: 54482
>>
>> -1
>>
>> I don't think this is the solution.
>>
>> The method  ConversionUtils.sanitizeUrl(URL) only works for URLs that
>> are not encoded.
>>
>> For example, if the URL contains %25 as the encoded version of %, this
>> will be re-encoded as %2525.
>>
>> See also comments on the Bugzilla issue.
>>
>> > Modified:
>> >
>> jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHC3Impl.java
>> >
>> jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHC4Impl.java
>> >     jmeter/trunk/xdocs/changes.xml
>> >
>> > Modified:
>> jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHC3Impl.java
>> > URL:
>> http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHC3Impl.java?rev=1511125&r1=1511124&r2=1511125&view=diff
>> >
>> ==============================================================================
>> > ---
>> jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHC3Impl.java
>> (original)
>> > +++
>> jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHC3Impl.java
>> Tue Aug  6 21:30:55 2013
>> > @@ -23,6 +23,7 @@ import java.io.IOException;
>> >  import java.io.InputStream;
>> >  import java.io.OutputStream;
>> >  import java.net.InetAddress;
>> > +import java.net.URISyntaxException;
>> >  import java.net.URL;
>> >  import java.net.URLDecoder;
>> >  import java.util.ArrayList;
>> > @@ -69,6 +70,7 @@ import org.apache.jmeter.protocol.http.c
>> >  import org.apache.jmeter.protocol.http.control.CacheManager;
>> >  import org.apache.jmeter.protocol.http.control.CookieManager;
>> >  import org.apache.jmeter.protocol.http.control.HeaderManager;
>> > +import org.apache.jmeter.protocol.http.util.ConversionUtils;
>> >  import org.apache.jmeter.protocol.http.util.EncoderCache;
>> >  import org.apache.jmeter.protocol.http.util.HTTPArgument;
>> >  import org.apache.jmeter.protocol.http.util.HTTPConstants;
>> > @@ -314,7 +316,11 @@ public class HTTPHC3Impl extends HTTPHCA
>> >                  if (headerLocation == null) { // HTTP protocol
>> violation, but avoids NPE
>> >                      throw new IllegalArgumentException("Missing
>> location header");
>> >                  }
>> > -                res.setRedirectLocation(headerLocation.getValue());
>> > +                try {
>> > +
>>  res.setRedirectLocation(ConversionUtils.sanitizeUrl(new
>> URL(headerLocation.getValue())).toString());
>> > +                } catch (URISyntaxException e) {
>> > +                    log.error("Error sanitizing
>> URL:"+headerLocation.getValue());
>> > +                }
>> >              }
>> >
>> >              // record some sizes to allow HTTPSampleResult.getBytes()
>> with different options
>> >
>> > 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=1511125&r1=1511124&r2=1511125&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
>> Tue Aug  6 21:30:55 2013
>> > @@ -26,6 +26,7 @@ import java.io.OutputStream;
>> >  import java.io.UnsupportedEncodingException;
>> >  import java.net.InetAddress;
>> >  import java.net.URI;
>> > +import java.net.URISyntaxException;
>> >  import java.net.URL;
>> >  import java.net.URLDecoder;
>> >  import java.nio.charset.Charset;
>> > @@ -102,6 +103,7 @@ import org.apache.jmeter.protocol.http.c
>> >  import org.apache.jmeter.protocol.http.control.CacheManager;
>> >  import org.apache.jmeter.protocol.http.control.CookieManager;
>> >  import org.apache.jmeter.protocol.http.control.HeaderManager;
>> > +import org.apache.jmeter.protocol.http.util.ConversionUtils;
>> >  import org.apache.jmeter.protocol.http.util.EncoderCache;
>> >  import org.apache.jmeter.protocol.http.util.HC4TrustAllSSLSocketFactory;
>> >  import org.apache.jmeter.protocol.http.util.HTTPArgument;
>> > @@ -325,7 +327,11 @@ public class HTTPHC4Impl extends HTTPHCA
>> >                  if (headerLocation == null) { // HTTP protocol
>> violation, but avoids NPE
>> >                      throw new IllegalArgumentException("Missing
>> location header");
>> >                  }
>> > -                res.setRedirectLocation(headerLocation.getValue());
>> > +                try {
>> > +
>>  res.setRedirectLocation(ConversionUtils.sanitizeUrl(new
>> URL(headerLocation.getValue())).toString());
>> > +                } catch (URISyntaxException e) {
>> > +                    log.error("Error sanitizing
>> URL:"+headerLocation.getValue());
>> > +                }
>> >              }
>> >
>> >              // record some sizes to allow HTTPSampleResult.getBytes()
>> with different options
>> >
>> > Modified: jmeter/trunk/xdocs/changes.xml
>> > URL:
>> http://svn.apache.org/viewvc/jmeter/trunk/xdocs/changes.xml?rev=1511125&r1=1511124&r2=1511125&view=diff
>> >
>> ==============================================================================
>> > --- jmeter/trunk/xdocs/changes.xml (original)
>> > +++ jmeter/trunk/xdocs/changes.xml Tue Aug  6 21:30:55 2013
>> > @@ -223,6 +223,7 @@ Previously the default was 1, which coul
>> >  <li><bugzilla>55023</bugzilla> - SSL Context reuse feature
(51380)
>> adversely affects non-ssl request performance/throughput</li>
>> >  <li><bugzilla>55092</bugzilla> - Log message "WARN -
>> jmeter.protocol.http.sampler.HTTPSamplerBase: Null URL detected (should not
>> happen)" displayed when embedded resource URL is malformed</li>
>> >  <li><bugzilla>55161</bugzilla> - Useless processing in
>> SoapSampler.setPostHeaders</li>
>> > +<li><bugzilla>54482</bugzilla> - HC fails to follow redirects
with
>> non-encoded chars</li>
>> >  </ul>
>> >
>> >  <h3>Other Samplers</h3>
>> >
>> >
>>
>
>
>
> --
> Cordialement.
> Philippe Mouawad.

Mime
View raw message