Author: pmouawad
Date: Sun Mar 3 10:19:20 2019
New Revision: 1854682
URL: http://svn.apache.org/viewvc?rev=1854682&view=rev
Log:
Bug 62977 - Unable to send HTTP requests without a User-Agent header
Bugzilla Id: 62977
Modified:
jmeter/trunk/bin/jmeter.properties
jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHC4Impl.java
jmeter/trunk/xdocs/changes.xml
jmeter/trunk/xdocs/usermanual/properties_reference.xml
Modified: jmeter/trunk/bin/jmeter.properties
URL: http://svn.apache.org/viewvc/jmeter/trunk/bin/jmeter.properties?rev=1854682&r1=1854681&r2=1854682&view=diff
==============================================================================
--- jmeter/trunk/bin/jmeter.properties (original)
+++ jmeter/trunk/bin/jmeter.properties Sun Mar 3 10:19:20 2019
@@ -404,6 +404,9 @@ remote_hosts=127.0.0.1
# Uncomment this line if you put anything in hc.parameters file
#hc.parameters.file=hc.parameters
+# If true, default HC4 User-Agent will not be added
+#httpclient4.default_user_agent_disabled=false
+
# Preemptively send Authorization Header when BASIC auth is used
#httpclient4.auth.preemptive=true
Modified: jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHC4Impl.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHC4Impl.java?rev=1854682&r1=1854681&r2=1854682&view=diff
==============================================================================
--- jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHC4Impl.java
(original)
+++ jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHC4Impl.java
Sun Mar 3 10:19:20 2019
@@ -186,6 +186,8 @@ public class HTTPHC4Impl extends HTTPHCA
private static final String CONTEXT_ATTRIBUTE_METRICS = "__jmeter.M__";
+ private static final boolean DISABLE_DEFAULT_UA = JMeterUtils.getPropDefault("httpclient4.default_user_agent_disabled",
false);
+
private static final boolean GZIP_RELAX_MODE = JMeterUtils.getPropDefault("httpclient4.gzip_relax_mode",
false);
private static final boolean DEFLATE_RELAX_MODE = JMeterUtils.getPropDefault("httpclient4.deflate_relax_mode",
false);
@@ -1040,7 +1042,9 @@ public class HTTPHC4Impl extends HTTPHCA
setConnectionTimeToLive(TIME_TO_LIVE, TimeUnit.MILLISECONDS).
setRetryHandler(new StandardHttpRequestRetryHandler(RETRY_COUNT, REQUEST_SENT_RETRY_ENABLED)).
setConnectionReuseStrategy(DefaultClientConnectionReuseStrategy.INSTANCE);
-
+ if(DISABLE_DEFAULT_UA) {
+ builder.disableDefaultUserAgent();
+ }
Lookup<AuthSchemeProvider> authSchemeRegistry =
RegistryBuilder.<AuthSchemeProvider>create()
.register(AuthSchemes.BASIC, new BasicSchemeFactory())
Modified: jmeter/trunk/xdocs/changes.xml
URL: http://svn.apache.org/viewvc/jmeter/trunk/xdocs/changes.xml?rev=1854682&r1=1854681&r2=1854682&view=diff
==============================================================================
--- jmeter/trunk/xdocs/changes.xml [utf-8] (original)
+++ jmeter/trunk/xdocs/changes.xml [utf-8] Sun Mar 3 10:19:20 2019
@@ -76,11 +76,12 @@ Summary
<h3>HTTP Samplers and Test Script Recorder</h3>
<ul>
+ <li><bug>62977</bug>Unable to send HTTP requests without a User-Agent
header</li>
</ul>
<h3>Other samplers</h3>
<ul>
- <li><bug>63185</bug>Add option to implicitly trust SSL/TLS connections/Disable
hostname verification. Based on contribution by Brian Wolfe (wolfebrian2120 at gmail.com)</li>
+ <li><bug>63185</bug>LDAP related elements: Add option to implicitly
trust SSL/TLS connections/Disable hostname verification. Based on contribution by Brian Wolfe
(wolfebrian2120 at gmail.com)</li>
</ul>
<h3>Controllers</h3>
Modified: jmeter/trunk/xdocs/usermanual/properties_reference.xml
URL: http://svn.apache.org/viewvc/jmeter/trunk/xdocs/usermanual/properties_reference.xml?rev=1854682&r1=1854681&r2=1854682&view=diff
==============================================================================
--- jmeter/trunk/xdocs/usermanual/properties_reference.xml (original)
+++ jmeter/trunk/xdocs/usermanual/properties_reference.xml Sun Mar 3 10:19:20 2019
@@ -543,6 +543,10 @@ JMETER-SERVER</source>
Ignore EOFException that some edgy application may emit to signal end of GZipped stream.<br/>
Defaults to: <code>false</code>
</property>
+<property name="httpclient4.default_user_agent_disabled">
+ If true, default HC4 User-Agent (Apache-HttpClient/X.Y.Z (Java/A.B.C_D)) will not be
added.<br/>
+ Defaults to: <code>false</code>
+</property>
</properties>
</section>
|