http://localhost:8080/%5B%5D
On 7 August 2013 15:37, Philippe Mouawad <[email protected]> wrote: > could you give me an example ? > thanks > > On Wednesday, August 7, 2013, sebb wrote: > >> On 7 August 2013 13:56, Philippe Mouawad >> <[email protected]<javascript:;>> >> 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 <[email protected]> wrote: >> > >> >> On 6 August 2013 22:30, <[email protected]> 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.er > > > > -- > Cordialement. > Philippe Mouawad.
