Bug 42022

Summary: HTTPSampler does not allow multiple headers of same name
Product: JMeter - Now in Github Reporter: Michael Matthews <mikesafh>
Component: HTTPAssignee: JMeter issues mailing list <issues>
Status: RESOLVED FIXED    
Severity: normal    
Priority: P3    
Version: 2.2   
Target Milestone: ---   
Hardware: PC   
OS: Linux   

Description Michael Matthews 2007-04-02 09:49:56 UTC
I'm trying to set up a test that sends multiple headers of the same name to a website.  If I add one HTTP 
Header Manager config element with multiple headers, or multiple HTTP Header Manager config 
elements each with one header, jmeter uses the last configured header as the only one in the actual 
request.

For example, with a header manager configuration as follows (cut 'n paste from xml file):

        <HeaderManager guiclass="HeaderPanel" testclass="HeaderManager" testname
="Multiple X-F-F headers" enabled="true">
          <collectionProp name="HeaderManager.headers">
            <elementProp name="" elementType="Header">
              <stringProp name="Header.value">192.168.1.1</stringProp>
              <stringProp name="Header.name">X-Forwarded-For</stringProp>
            </elementProp>
            <elementProp name="" elementType="Header">
              <stringProp name="Header.value">192.168.1.2</stringProp>
              <stringProp name="Header.name">X-Forwarded-For</stringProp>
            </elementProp>
          </collectionProp>
        </HeaderManager>
        <hashTree/>
        <HeaderManager guiclass="HeaderPanel" testclass="HeaderManager" testname
="More X-F-F" enabled="true">
          <collectionProp name="HeaderManager.headers">
            <elementProp name="" elementType="Header">
              <stringProp name="Header.value">192.168.1.3</stringProp>
              <stringProp name="Header.name">X-Forwarded-For</stringProp>
            </elementProp>
          </collectionProp>
        </HeaderManager>
Comment 1 Sebb 2007-04-02 16:51:08 UTC
Thanks for the report.

Found the problem - HTTPSampler was using setRequestProperty instead of 
addRequestProperty, so only one of each header was saved. Also the values were 
not being set up correctly for the TreeView request pane.

The code has been fixed in SVN and will appear in nightlies after r524971.

The HTTPClient Sampler was not affected.
Comment 2 Michael Matthews 2007-04-03 12:06:46 UTC
Thanks for the fix and suggestions, appreciate the fast turnaround.

Mike
Comment 3 Sebb 2007-04-03 12:59:25 UTC
No problem; it was fairly simple to fix which helps to speed things up!

By the way, the currently nightly r525254 (or any later ones) will include the 
fix.
Comment 4 The ASF infrastructure team 2022-09-24 20:37:39 UTC
This issue has been migrated to GitHub: https://github.com/apache/jmeter/issues/1904