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.
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.
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.
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
This issue has been migrated to GitHub: https://github.com/apache/jmeter/issues/3642