Bug 58201 - Usage of port from host header in http sampler inconsistent
Summary: Usage of port from host header in http sampler inconsistent
Status: RESOLVED FIXED
Alias: None
Product: JMeter
Classification: Unclassified
Component: HTTP (show other bugs)
Version: 2.13
Hardware: All All
: P2 normal (vote)
Target Milestone: ---
Assignee: JMeter issues mailing list
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-07-31 19:25 UTC by Felix Schumacher
Modified: 2015-08-23 09:42 UTC (History)
0 users



Attachments
Don't strip port from http Host header in httpclient 3 and use port from header in httpclient 4 (3.35 KB, patch)
2015-07-31 19:25 UTC, Felix Schumacher
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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
Log:
Use the port from a given host header, if available.

Bugzilla Id: 58201

Modified:
    jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHC4Impl.java
    jmeter/trunk/xdocs/changes.xml