Bug 32345

Summary: HTTP URL-Rewriting Modifier doesn't work with path set in HTTP Request Default
Product: JMeter - Now in Github Reporter: Stefan Reinhold <octi73>
Component: HTTPAssignee: JMeter issues mailing list <issues>
Status: RESOLVED FIXED    
Severity: normal    
Priority: P2    
Version: 2.0.1   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Attachments: Testcase

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.
Comment 6 The ASF infrastructure team 2022-09-24 20:37:34 UTC
This issue has been migrated to GitHub: https://github.com/apache/jmeter/issues/1473