Bug 58201

Summary: Usage of port from host header in http sampler inconsistent
Product: JMeter Reporter: Felix Schumacher <felix.schumacher>
Component: HTTPAssignee: JMeter issues mailing list <issues>
Severity: normal    
Priority: P2    
Version: 2.13   
Target Milestone: ---   
Hardware: All   
OS: All   
Attachments: Don't strip port from http Host header in httpclient 3 and use port from header in httpclient 4

Description Felix Schumacher 2015-07-31 19:25:12 UTC
Created attachment 32949 [details]
Don't strip port from http Host header in httpclient 3 and use port from header in httpclient 4

The port numbers in a user defined http Host header differ by client implementations in http sampler.

* httpclient 4 will replace the port number with the port number extracted from the sampler
* httpclient 3 will remove the port number entirely
* javaclient will leave the port number untouched

This behaviour is inconsistent and the httpclient behaviour is probably not wanted by the users (see http://jmeter.markmail.org/thread/457kefpz4cmtlqvd)

The implementation was updated in response to bug #51775. In my tests the attached patch does not exhibit the described double port number when using a proxy and specifying the host header explicitly. Maybe the httpclient implementations where changed in between.
Comment 1 Milamber 2015-08-01 14:16:42 UTC
The patch works with HC4 but not for HC3. The removing of the replaceFirst in HC3 come back the double port in headers Host key when you record a script (when the URL uses a port different of 80)

Probably the HC3 has need the method getPortFromHostHeader() like the HC4.
Comment 2 Felix Schumacher 2015-08-02 09:45:34 UTC
OK, now I see the double port with httpclient 3.x. Strange that it only shows on our internal proxy. When I use a proxy setup in http sampler it doesn't show up.
Comment 3 Felix Schumacher 2015-08-23 09:42:06 UTC
As I haven't found a way to make httpclient 3 correctly, I have only committed the changes for httpclient 4.

That will not make all samplers behave consistently, but it will allow httpclient to behave similar to the java sampler and let the user specify a port number.

In my eyes httpclient 3 still shows the wrong behaviour, but can't be changed.

Date: Sun Aug 23 09:39:19 2015
New Revision: 1697158

URL: http://svn.apache.org/r1697158
Use the port from a given host header, if available.

Bugzilla Id: 58201