You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@jmeter.apache.org by Nikita Tovstoles <ni...@gmail.com> on 2010/04/07 18:47:05 UTC

rewrite absolute URLs containing '/../'?

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?

thanks

-nikita

---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-user-help@jakarta.apache.org


Re: rewrite absolute URLs containing '/../'?

Posted by Nikita Tovstoles <ni...@gmail.com>.
Issue + patch filed:
https://issues.apache.org/bugzilla/show_bug.cgi?id=49083

<https://issues.apache.org/bugzilla/show_bug.cgi?id=49083>-nikita

On Fri, Apr 9, 2010 at 7:36 AM, sebb <se...@gmail.com> wrote:

> On 09/04/2010, Nikita Tovstoles <ni...@gmail.com> wrote:
> > Shoot - maybe I am missing something - that code path only gets executed
> >  when 'redirect automatically' is unchecked and 'follow redirects' is
> >  checked. Reading the user manual, I guess that's what one'd want...
>
> Yes - "redirect automatically" is done by the HTTP implementation so
> JMeter never sees it.
>
> >  On Thu, Apr 8, 2010 at 9:26 PM, Nikita Tovstoles <
> nikita.tovstoles@gmail.com
> >
> > > wrote:
> >
> >  > 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 <
> >  > nikita.tovstoles@gmail.com> 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 <se...@gmail.com> wrote:
> >  >>
> >  >>> On 07/04/2010, Nikita Tovstoles <ni...@gmail.com> 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:
> jmeter-user-unsubscribe@jakarta.apache.org
> >  >>> >  For additional commands, e-mail:
> jmeter-user-help@jakarta.apache.org
> >  >>> >
> >  >>> >
> >  >>>
> >  >>>
> ---------------------------------------------------------------------
> >  >>> To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
> >  >>> For additional commands, e-mail:
> jmeter-user-help@jakarta.apache.org
> >  >>>
> >  >>>
> >  >>
> >  >>
> >  >
> >  >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
>
>

Re: rewrite absolute URLs containing '/../'?

Posted by sebb <se...@gmail.com>.
On 09/04/2010, Nikita Tovstoles <ni...@gmail.com> wrote:
> Shoot - maybe I am missing something - that code path only gets executed
>  when 'redirect automatically' is unchecked and 'follow redirects' is
>  checked. Reading the user manual, I guess that's what one'd want...

Yes - "redirect automatically" is done by the HTTP implementation so
JMeter never sees it.

>  On Thu, Apr 8, 2010 at 9:26 PM, Nikita Tovstoles <nikita.tovstoles@gmail.com
>
> > wrote:
>
>  > 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 <
>  > nikita.tovstoles@gmail.com> 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 <se...@gmail.com> wrote:
>  >>
>  >>> On 07/04/2010, Nikita Tovstoles <ni...@gmail.com> 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: jmeter-user-unsubscribe@jakarta.apache.org
>  >>> >  For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
>  >>> >
>  >>> >
>  >>>
>  >>> ---------------------------------------------------------------------
>  >>> To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
>  >>> For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
>  >>>
>  >>>
>  >>
>  >>
>  >
>  >
>

---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-user-help@jakarta.apache.org


Re: rewrite absolute URLs containing '/../'?

Posted by Nikita Tovstoles <ni...@gmail.com>.
Shoot - maybe I am missing something - that code path only gets executed
when 'redirect automatically' is unchecked and 'follow redirects' is
checked. Reading the user manual, I guess that's what one'd want...

On Thu, Apr 8, 2010 at 9:26 PM, Nikita Tovstoles <nikita.tovstoles@gmail.com
> wrote:

> 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 <
> nikita.tovstoles@gmail.com> 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 <se...@gmail.com> wrote:
>>
>>> On 07/04/2010, Nikita Tovstoles <ni...@gmail.com> 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: jmeter-user-unsubscribe@jakarta.apache.org
>>> >  For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
>>> >
>>> >
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
>>> For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
>>>
>>>
>>
>>
>
>

Re: rewrite absolute URLs containing '/../'?

Posted by sebb <se...@gmail.com>.
On 09/04/2010, Nikita Tovstoles <ni...@gmail.com> wrote:
> 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.

Thanks very much, but the mailing list is not the place to post
patches - attachments are often dropped, as in this case.

Please could you create a Bugzilla enhancement issue and attach the
patch to that?

> 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.

I'll have a look at the patch when it has been uploaded.

As to adding an option to switch the behaviour, in this case it will
probably be enough to use a JMeter property - I'll add this.

> -nikita
>
>
>
>
>
> On Thu, Apr 8, 2010 at 8:39 AM, Nikita Tovstoles
> <ni...@gmail.com> 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 <se...@gmail.com> wrote:
> >
> > >
> > >
> > >
> > > On 07/04/2010, Nikita Tovstoles <ni...@gmail.com> 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:
> jmeter-user-unsubscribe@jakarta.apache.org
> > > >  For additional commands, e-mail:
> jmeter-user-help@jakarta.apache.org
> > > >
> > > >
> > >
> > >
> ---------------------------------------------------------------------
> > > To unsubscribe, e-mail:
> jmeter-user-unsubscribe@jakarta.apache.org
> > > For additional commands, e-mail:
> jmeter-user-help@jakarta.apache.org
> > >
> > >
> >
> >
> >
>
>
>
>
> ---------------------------------------------------------------------
>  To unsubscribe, e-mail:
> jmeter-user-unsubscribe@jakarta.apache.org
>  For additional commands, e-mail:
> jmeter-user-help@jakarta.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-user-help@jakarta.apache.org


Re: rewrite absolute URLs containing '/../'?

Posted by Nikita Tovstoles <ni...@gmail.com>.
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 <nikita.tovstoles@gmail.com
> 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 <se...@gmail.com> wrote:
>
>> On 07/04/2010, Nikita Tovstoles <ni...@gmail.com> 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: jmeter-user-unsubscribe@jakarta.apache.org
>> >  For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
>> >
>> >
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
>>
>>
>
>

Re: rewrite absolute URLs containing '/../'?

Posted by Nikita Tovstoles <ni...@gmail.com>.
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 <se...@gmail.com> wrote:

> On 07/04/2010, Nikita Tovstoles <ni...@gmail.com> 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: jmeter-user-unsubscribe@jakarta.apache.org
> >  For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
>
>

Re: rewrite absolute URLs containing '/../'?

Posted by sebb <se...@gmail.com>.
On 07/04/2010, Nikita Tovstoles <ni...@gmail.com> 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: jmeter-user-unsubscribe@jakarta.apache.org
>  For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-user-help@jakarta.apache.org


Re: rewrite absolute URLs containing '/../'?

Posted by Deepak Shetty <sh...@gmail.com>.
Hi
I meant you can add code to Jmeter.

If this is only happening for a page or for a few pages , you can write some
simple java/javascript code to fix the url.
Change JMeter to uncheck both follow redirect and redirect automatically,
check if returned status code is a redirect one, extract out the location
header and fix it using the code above (perhaps via a beanshell or
javascript function).
If you need to do this for all or most URL's then its tedious, though you
might be able to reduce the grunt work by using module controllers /
generating the scripts.


regards
deepak

On Wed, Apr 7, 2010 at 10:31 AM, Nikita Tovstoles <
nikita.tovstoles@gmail.com> wrote:

> Unf. it's not my code, and changing it appears to be non-trivial.
> We're using wicket which does relative 302 redirects on all initial
> page requests. Suppose you've an app deployed at:
>
> http://localhost/app/
>
> and a particular page at http://localhost/app/page/
>
> 1) First request to:
> http://localhost/app/page/
>
> 2) will result in 302 with Location:
> http://localhost/app/page/ . . /page.0  (spaces added to avoid spam
> filter)
>
> 3) All major browsers (including IE6 and wget) will then issue a GET for:
> http://localhost/app/page.0
>
> but JMeter issues a GET for 2) as is. And that results in a 404.
>
>
> There's been a discussion on this before:
> http://www.mail-archive.com/jmeter-user@jakarta.apache.org/msg28360.html
>
> and several JIRAs filed:
> https://issues.apache.org/jira/browse/WICKET-2728
>
> but, as I am sure you understand, we poor app developers, need to
> load-test our stuff one way or another at the end of the day. I am not
> clear (yet) whether:
> -wicket returns the URL in 2) as you see it (in which case the fix
> w/in wicket framework may indeed be easy) OR
> -wicket redirects to . . /page.0 and it's either Tomcat or the client
> that interprets it as what one sees in 2) (in which case the fix is
> indeed easier in JMeter).
>
>
> Hope the above explains my motivation
>
>
>
>
>
>
> On Wed, Apr 7, 2010 at 10:01 AM, Deepak Shetty <sh...@gmail.com> wrote:
> > Jmeter fetches URL's that you ask to fetch (so you can format them any
> which
> > way you want), so where are you seeing this problem? in redirects (you
> can
> > deal with this by writing a little code instead of needing to change
> Jmeter
> > code)?
> > Jmeter Code should be in
> > org.apache.jmeter.protocol.http.sampler.HTTPSampler/2  (not verified)
> >
> >
> > regards
> > deepak
> >
> >
> > On Wed, Apr 7, 2010 at 9:47 AM, Nikita Tovstoles <
> nikita.tovstoles@gmail.com
> >> 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?
> >>
> >> thanks
> >>
> >> -nikita
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
> >> For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
> >>
> >>
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
>
>

Re: rewrite absolute URLs containing '/../'?

Posted by Nikita Tovstoles <ni...@gmail.com>.
Unf. it's not my code, and changing it appears to be non-trivial.
We're using wicket which does relative 302 redirects on all initial
page requests. Suppose you've an app deployed at:

http://localhost/app/

and a particular page at http://localhost/app/page/

1) First request to:
http://localhost/app/page/

2) will result in 302 with Location:
http://localhost/app/page/ . . /page.0  (spaces added to avoid spam filter)

3) All major browsers (including IE6 and wget) will then issue a GET for:
http://localhost/app/page.0

but JMeter issues a GET for 2) as is. And that results in a 404.


There's been a discussion on this before:
http://www.mail-archive.com/jmeter-user@jakarta.apache.org/msg28360.html

and several JIRAs filed:
https://issues.apache.org/jira/browse/WICKET-2728

but, as I am sure you understand, we poor app developers, need to
load-test our stuff one way or another at the end of the day. I am not
clear (yet) whether:
-wicket returns the URL in 2) as you see it (in which case the fix
w/in wicket framework may indeed be easy) OR
-wicket redirects to . . /page.0 and it's either Tomcat or the client
that interprets it as what one sees in 2) (in which case the fix is
indeed easier in JMeter).


Hope the above explains my motivation






On Wed, Apr 7, 2010 at 10:01 AM, Deepak Shetty <sh...@gmail.com> wrote:
> Jmeter fetches URL's that you ask to fetch (so you can format them any which
> way you want), so where are you seeing this problem? in redirects (you can
> deal with this by writing a little code instead of needing to change Jmeter
> code)?
> Jmeter Code should be in
> org.apache.jmeter.protocol.http.sampler.HTTPSampler/2  (not verified)
>
>
> regards
> deepak
>
>
> On Wed, Apr 7, 2010 at 9:47 AM, Nikita Tovstoles <nikita.tovstoles@gmail.com
>> 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?
>>
>> thanks
>>
>> -nikita
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
>>
>>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-user-help@jakarta.apache.org


Re: rewrite absolute URLs containing '/../'?

Posted by Deepak Shetty <sh...@gmail.com>.
Jmeter fetches URL's that you ask to fetch (so you can format them any which
way you want), so where are you seeing this problem? in redirects (you can
deal with this by writing a little code instead of needing to change Jmeter
code)?
Jmeter Code should be in
org.apache.jmeter.protocol.http.sampler.HTTPSampler/2  (not verified)


regards
deepak


On Wed, Apr 7, 2010 at 9:47 AM, Nikita Tovstoles <nikita.tovstoles@gmail.com
> 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?
>
> thanks
>
> -nikita
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
>
>