Attached, please find a trunk patch that introduces ConversionUtils.removeSlashDotDot(url) method called from HttpSamplerBase.followRedirects(HTTPSampleResult, int) only. There's also a unit test.
There's no switch because a) I wasn't sure where to add one b) no unit tests failed. If that's absolutely required and other folks have no cycles to add such as switch do let me know and I'll see what I can do (or I should say when). Otherwise, let me know if anything else's required to accept the patch. -nikita On Thu, Apr 8, 2010 at 8:39 AM, Nikita Tovstoles <[email protected] > wrote: > Wicket renders *relative* URLs leading with '../' in CSS, image links (and > possibly anchors). However, in this case the problem is with absolute URLs > containing '/../'. Those are created during redirects only because: > > - wicket issues a redirect to a *relative* url starting with '../' > - Tomcat, before writing out a response, rewrites the URL as absolute - > w/o collapsing the path. See encodeRedirectURL here: > http://kickjava.com/src/org/apache/catalina/connector/Response.java.htm > > I'll take a stab at collapsing the URL > in HttpSamplerBase.followRedirects(HTTPSampleResult, int) > > -nikita > > > On Wed, Apr 7, 2010 at 10:53 AM, sebb <[email protected]> wrote: > >> On 07/04/2010, Nikita Tovstoles <[email protected]> wrote: >> > Hello, >> > >> > I need JMeter to rewrite absolute URLs containing '/../' For example, >> major >> > browsers & wget, given: >> > >> > http://www.google.com/products/ . . / products >> > (spaces added to avoid SPAM filtering) >> > >> > will actually send HTTP GET for >> > >> > http://www.google.com/products/ >> > >> > JMeter 2.3.4 appears to send the initial URL verbatim, which results in >> a >> > 404 if pointed against a vanilla Tomcat. >> > >> > We're using Wicket and URLs similar to the above are very common >> (Wicket >> > issues redirects like the above). I saw discussions from a couple of >> months >> > ago wrt whose responsibility it is to normalize the URL and read the >> RFC. I >> > understand positions on either side, but, unfortunately, do really need >> to >> > load test our app asap ;- >> > >> > So, I am happy to fork JMeter locally, if needed. If the above indeed >> > requires a code change in JMeter (or HttpClient?) could someone please >> > respond with a hint as to where specifically I should look in src? >> >> The method is >> >> org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.sample(URL u, >> String method, boolean areFollowingRedirect, int depth) >> >> This is abstract, and is overridden by various samplers, including: >> >> org.apache.jmeter.protocol.http.sampler.HTTPSampler.sample(URL url, >> String method, boolean areFollowingRedirect, int frameDepth) >> >> org.apache.jmeter.protocol.http.sampler.HTTPSampler2.sample(URL url, >> String method, boolean areFollowingRedirect, int frameDepth) >> >> However, if you want to just fix redirects, this could be done in >> >> HttpSamplerBase.followRedirects(HTTPSampleResult, int) >> >> Note that JMeter 2.3.4 already allows for relative links starting with ../ >> See https://issues.apache.org/bugzilla/show_bug.cgi?id=46690. >> >> JMeter could be enhanced to allow such URL fixing as an option. >> Changing it unconditionally could break some test scripts. >> >> BTW, are these dotty URLs used anywhere apart from redirects? >> >> > thanks >> > >> > -nikita >> > >> > --------------------------------------------------------------------- >> > To unsubscribe, e-mail: [email protected] >> > For additional commands, e-mail: [email protected] >> > >> > >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: [email protected] >> For additional commands, e-mail: [email protected] >> >> > >
--------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]

