Bug 32345 - HTTP URL-Rewriting Modifier doesn't work with path set in HTTP Request Default
HTTP URL-Rewriting Modifier doesn't work with path set in HTTP Request Default
Status: RESOLVED FIXED
Product: JMeter
Classification: Unclassified
Component: HTTP
2.0.1
PC Windows XP
: P2 normal (vote)
: ---
Assigned To: JMeter issues mailing list
:
Depends on:
Blocks:
  Show dependency tree
 
Reported: 2004-11-22 12:30 UTC by Stefan Reinhold
Modified: 2005-03-11 18:09 UTC (History)
0 users



Attachments
Testcase (31.48 KB, application/octet-stream)
2004-11-22 12:32 UTC, Stefan Reinhold
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Stefan Reinhold 2004-11-22 12:30:36 UTC
I have a test case where I use an HTTP Request Default config element to specify
the path to call and HTTP samplers which specify only request parameters. Using
the HTTP URL-Rewriting Modifier to include the session id in the subsequent
requests (format:
http://server:port/path/to/servlet.do;jsessionid=asessionid?ID=value) does not
work. The requests made are in format
http://server:port/;jsessionid=asessionid?ID=value. Only if I specify the path
in each HTTP sampler the subsequent requests are made correctly.
Comment 1 Stefan Reinhold 2004-11-22 12:32:20 UTC
Created attachment 13517 [details]
Testcase
Comment 2 Sebb 2004-11-25 00:52:12 UTC
The attached testplan has two HTTP Request Default elements; these are both in
the scope of all the HTTP Samplers. It would be better to combine these, as
there's no guarantee which one will be applied first.

May I suggest that you try the test again with a single HTTP Request Default
element? This might fix the problem.
Comment 3 Stefan Reinhold 2004-11-25 06:53:31 UTC
(In reply to comment #2)
> The attached testplan has two HTTP Request Default elements; these are both in
> the scope of all the HTTP Samplers. It would be better to combine these, as
> there's no guarantee which one will be applied first.

The had the inner HTTP Request Default elements disabled and it didn't work
either. Now I tested it again with removing it. So I had only one request
default element with all the information including path and the bug was still alive.

By the way having the two request default elements worked perfectly when I
disabled the URL-rewriting modifier.

> 
> May I suggest that you try the test again with a single HTTP Request Default
> element? This might fix the problem.

Comment 4 Stefan Reinhold 2004-12-17 08:28:34 UTC
After debugging a bit I noticed that swapping two lines in
org.apache.jmeter.threads.TestCompiler.configureSampler(Sampler) solved the
problem for me.
When configureWithConfigElements(sampler, pack.getConfigs()); goes before
runPreProcessors(pack.getPreProcessors()); then the substitution is done correctly.
Excerpt from revision 1.42 with my change applied:
    public SamplePackage configureSampler(Sampler sampler)
    {
        //NOTREAD currentSampler = sampler;
        SamplePackage pack = (SamplePackage) samplerConfigMap.get(sampler);
        pack.setSampler(sampler);
        configureWithConfigElements(sampler, pack.getConfigs());
        runPreProcessors(pack.getPreProcessors());
        //replaceStatics(ret);
        return pack;
    }
I did not verify this change with the latest Nightly Build but with release 2.0.2.

Regards,
Stefan
Comment 5 Sebb 2004-12-18 00:22:07 UTC
I think you've hit the nail on the head.

Makes sense to apply the Config elements before the Pre-Processors.

I've committed the change to the 2.0 branch.