Author: sebb Date: Tue May 17 19:30:06 2011 New Revision: 1104485 URL: http://svn.apache.org/viewvc?rev=1104485&view=rev Log: Bug 50516 - "Host" header in HTTP Header Manager is not included in generated HTTP request
Modified: jakarta/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHC3Impl.java jakarta/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHC4Impl.java jakarta/jmeter/trunk/xdocs/changes.xml Modified: jakarta/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHC3Impl.java URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHC3Impl.java?rev=1104485&r1=1104484&r2=1104485&view=diff ============================================================================== --- jakarta/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHC3Impl.java (original) +++ jakarta/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHC3Impl.java Tue May 17 19:30:06 2011 @@ -593,7 +593,11 @@ public class HTTPHC3Impl extends HTTPHCA // TODO - what other headers are not allowed? if (! HEADER_CONTENT_LENGTH.equalsIgnoreCase(n)){ String v = header.getValue(); - method.addRequestHeader(n, v); + if (HEADER_HOST.equalsIgnoreCase(n)) { + method.getParams().setVirtualHost(v); + } else { + method.addRequestHeader(n, v); + } } } } Modified: jakarta/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHC4Impl.java URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHC4Impl.java?rev=1104485&r1=1104484&r2=1104485&view=diff ============================================================================== --- jakarta/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHC4Impl.java (original) +++ jakarta/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHC4Impl.java Tue May 17 19:30:06 2011 @@ -638,7 +638,18 @@ public class HTTPHC4Impl extends HTTPHCA // TODO - what other headers are not allowed? if (! HEADER_CONTENT_LENGTH.equalsIgnoreCase(n)){ String v = header.getValue(); - request.addHeader(n, v); + if (HEADER_HOST.equalsIgnoreCase(n)) { + // TODO is it a bug that HC 4.x does not add the correct port to the generated Host header? + int port = url.getPort(); + if (port != -1) { + if (port == url.getDefaultPort()) { + port = -1; // no need to specify the port if it is the default + } + } + request.getParams().setParameter(ClientPNames.VIRTUAL_HOST, new HttpHost(v, port)); + } else { + request.addHeader(n, v); + } } } } Modified: jakarta/jmeter/trunk/xdocs/changes.xml URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/xdocs/changes.xml?rev=1104485&r1=1104484&r2=1104485&view=diff ============================================================================== --- jakarta/jmeter/trunk/xdocs/changes.xml (original) +++ jakarta/jmeter/trunk/xdocs/changes.xml Tue May 17 19:30:06 2011 @@ -48,6 +48,7 @@ Note that Commons HttpClient 3.1 is no l <li>There are two new Thread Group types - setUp and tearDown - which are run before and after the main Thread groups.</li> <li>Client-Server mode now supports external stop/shutdown via UDP<br></br> multiple JMeter server instances can be started on the same host without needing to change the port property.</li> +<li>Bug 50516 - "Host" header in HTTP Header Manager is not included in generated HTTP request</li> </ul> <p> @@ -98,6 +99,7 @@ This is internal to the workings of the <li>Bug 50392 - value is trimmed when sending the request in Multipart</li> <li>Bug 50686 - HeaderManager logging too verbose when merging instances</li> <li>Bug 50963 - AjpSampler throws java.lang.StringIndexOutOfBoundsException</li> +<li>Bug 50516 - "Host" header in HTTP Header Manager is not included in generated HTTP request</li> </ul> <h3>Other Samplers</h3> --------------------------------------------------------------------- To unsubscribe, e-mail: notifications-unsubscr...@jakarta.apache.org For additional commands, e-mail: notifications-h...@jakarta.apache.org