[ grinder-Bugs-3287251 ] two test results when using request.setHeaders()
"SourceForge.net" <[email protected]> Fri, 15 Apr 2011 07:42:11 +0000
| Newsgroups | gmane.comp.java.grinder.devel |
|---|---|
| Message-ID | <[email protected]> |
Bugs item #3287251, was opened at 2011-04-15 09:42
Message generated for change (Tracker Item Submitted) made by vavra
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=118598&aid=3287251&group_id=18598
Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Core engine
Group: None
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Andreas Vavra (vavra)
Assigned to: Nobody/Anonymous (nobody)
Summary: two test results when using request.setHeaders()
Initial Comment:
grinder-3.4, jdk 1.6.0u24 (x86_64)
I use setDefaultHeaders() from HTTPPluginControl.getConnectionDefaults() to set some default headers, that have to be added to each request.
Furtermore I need to add one additional header to certain requests if certain conditions are met, using setHeaders() from a Test-wraped HTTPRequest.
Below a simple jython sample code showing how to reproduce the problem I've found:
====
from HTTPClient import NVPair
from HTTPClient import HTTPConnection
from net.grinder.script.Grinder import grinder
from net.grinder.script import Test
from net.grinder.plugin.http import HTTPRequest
from net.grinder.plugin.http import HTTPPluginControl
HOST_NAME="www.google.com"
URL="http://www.google.com/"
class TestRunner:
def __call__(self):
control = HTTPPluginControl.getConnectionDefaults()
control.setDefaultHeaders(
( NVPair('Accept','text/html'),
NVPair('Host',HOST_NAME),
))
doRequests()
def doRequests():
t1=Test(1000,"www.google.com with no additional headers")
t2=Test(2000,"www.google.com with If-Modified-Since")
t3=Test(3000,"www.google.com with X-header")
req1 = t1.wrap(HTTPRequest())
resp1 = req1.GET(URL)
req2 = t2.wrap(HTTPRequest())
req2.setHeaders( (NVPair("If-Modified-Since","14 Apr 2011 07:30:00 GMT"),) )
resp2 = req2.GET(URL)
req3 = t3.wrap(HTTPRequest())
req3.setHeaders( (NVPair("X-Funny-Header","Funny Value"),) )
resp3 = req3.GET(URL)
====
Tests t2 and t3 produce faulty results, because each test generates two (!!!) results in data.log, although only one request is sent across the wire (I've checked this using Wireshark). The first result has only zeros as values, the second result represents the real values of the test.
Below the data.log of the above script:
===
Thread, Run, Test, Start time (ms since Epoch), Test time, Errors, HTTP response code, HTTP response length, HTTP response errors, Time to resolve host, Time to establish connection, Time to first byte
0, 0, 1000, 1302849618364, 56, 0, 502, 58, 1, 0, 0, 42
0, 0, 2000, 1302849618421, 0, 0, 0, 0, 0, 0, 0, 0
0, 0, 2000, 1302849618421, 3, 0, 502, 58, 1, 0, 1, 2
0, 0, 3000, 1302849618424, 0, 0, 0, 0, 0, 0, 0, 0
0, 0, 3000, 1302849618424, 11, 0, 502, 58, 1, 1, 1, 11
===
Since I'm rather new to grinder (and to the grinder source code as well) I've not been able to find the place in the source, where the above thing go wrong.
Kind Regards
Andi
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=118598&aid=3287251&group_id=18598
------------------------------------------------------------------------------
Benefiting from Server Virtualization: Beyond Initial Workload
Consolidation -- Increasing the use of server virtualization is a top
priority.Virtualization can reduce costs, simplify management, and improve
application availability and disaster protection. Learn more about boosting
the value of server virtualization. http://p.sf.net/sfu/vmware-sfdev2dev