Bug 35026 - Http Proxy server should have a setting to ignore web server fields
Summary: Http Proxy server should have a setting to ignore web server fields
Alias: None
Product: JMeter
Classification: Unclassified
Component: Main (show other bugs)
Version: 2.0.3
Hardware: All All
: P3 enhancement (vote)
Target Milestone: ---
Assignee: JMeter issues mailing list
Depends on:
Reported: 2005-05-23 18:31 UTC by Douglas Anderson
Modified: 2005-05-28 04:19 UTC (History)
0 users

A testplan that demonstrates the problem (24.61 KB, text/plain)
2005-05-25 00:11 UTC, Douglas Anderson

Note You need to log in before you can comment on or make changes to this bug.
Description Douglas Anderson 2005-05-23 18:31:45 UTC
In the proxy server it would be nice to have a ignore Web Server fields for the
recorded results. 

There are two possible scenerios where this would be helpful. The first is when
a variable is defined in the Test Plan element such as some sentinal value that
is not meant to be part of a url. When the proxy server comes accross this in
the URL it will substiute the name. i.e. I have the variable internet with the
value of 2 and when I use my server lr2 the proxy server sets the Server name as
lr${internet}. Which if the value for internet changes it breaks the test.

The second scenerio, and this is the more helpful one, is I have a default Http
request element already in a thread. In this case I do not want or need the Web
Server infomation. And actually it is to my detriment if I want to change web
servers. Example if I am benchmarking diffrent hardware profiles to see which
runs my Web Server application. Then I would want the flexibilty to change the
webserver in one place vs. having to change multiple http request samplers.
Comment 1 Sebb 2005-05-25 00:02:38 UTC
Works for me with a simple plan consisting of

Thread Group
- HTTP Defaults (http | www.apache.org | 80)
- Proxy server

Comment 2 Douglas Anderson 2005-05-25 00:11:35 UTC
Created attachment 15154 [details]
A testplan that demonstrates the problem
Comment 3 Douglas Anderson 2005-05-25 00:16:28 UTC
Attached is a testplan that I recorded that demonstrates the problem that I
explain in this request.

Note all of the http requests are www.${not_http}gle.com because I have a
variable that it replaced. 

Because this variable may not be intended for the http requests I do not think
it should be included in them.
Comment 4 Sebb 2005-05-25 00:33:38 UTC
The attached test plan has a default host of google.com, but the URL sampled
appears to have been www.google.com.

Try fixing the test plan to use the hostname www.google.com as default.

This will prevent the substitution of goo by ${not_http}.

Seems to me this fixes your second scenario.

As to the first scenario, perhaps you could be more specific about how you would
like variable substitution to work. i.e. under what circumstances should the
variable be replaced. 

To maintain backward compatibility, there would also need to be a way of telling
JMeter to use the new replacement algorithm.
Comment 5 Douglas Anderson 2005-05-25 01:43:10 UTC
"Try fixing the test plan to use the hostname www.google.com as default." 

This would only work if I deleted not_http first and then added a hostname
variable to the top of the list. And in the case that is not the simple test
case I created to demonstrate this problem that would mean I would have to
delete all the variables before the hostname. It is possible to do this but I
would think the software should be a little more flexible.

And as for
 "As to the first scenario, perhaps you could be more specific about how you would
Like variable substitution to work. i.e. under what circumstances should the
Variable be replaced. " 

I think that the problem is in the proxy server and not in all of JMeter. The
substitution for variables should be maintained as normal when running the test
case, but when recording only time string replacement should be done is on an
entire string and not in a substring.
Example: (in the sample test case) 
If I add the variable hostname www.google.com

And start to record again. I will get the same result I did before because it is
doing a replacement on part of the string which may not be what the user
intended. Such as demonstrated in the first example test scenario where I had a
server name variable but I had a weight variable before it. If the proxy server
matched the entire string it would have found my server variable further down
the list. Though if I did not have a servername variable I do not think I would
want part of the servername being replaced when recording.
Comment 6 Sebb 2005-05-25 21:50:36 UTC
When I tried using www.google.com in the HTTP default test element, the hostname
was omitted from the generated HTTP requests, and so there was no "goo" for the
 not_http variable to be matched against.

As to substitution, the Proxy currently substitutes the contents of a variable -
"goo" - with the variable name - ${not_http} - wherever the content string
appears. You are asking for the substitution to be restricted to complete
strings only. 

Fair enough, and this should be easy to change, but it might break existing scripts.

So I suggest adding whole string matching as an option in the Proxy GUI - or
perhaps as a property.

Would that meet your needs?
Comment 7 Douglas Anderson 2005-05-25 22:21:01 UTC
Yes either solution would be fine. Though I would perfer it to be in the Proxy GUI.
Comment 8 Sebb 2005-05-28 12:19:55 UTC
Decided to make it a bit more flexible, and added RE matching.

Proxy GUI has been updated to add a new checkbox - "Regex matching".

This treats the values as regexes, so full string matching can be specified by
enclosing the value in ^ and $, e.g. ^2$ for the internet example.

[Also fixed Proxy so TestElement.gui_class etc are not replaced]

Nightly build 20050528 contains the fixes