Using a HeaderManager for the request, if you do not add a User-Agent header, one is automatically added by default, like User-Agent: Apache-HttpClient/4.5.3 (Java/1.8.0_102) If I try specifying an empty UA header in the header manager, it sends the empty header. In the deprecated org.apache.http.impl.client.DefaultHttpClient, it sets the defaults for the connection and the problem appears that there is no way to override those defaults so that no UA header is sent as it adds that default UA header if there is no UA in the request. A lot of current testing is not testing websites, so this header is pretty redundant for a lot of traffic, e.e. in a micro service architecture environment.
This header is by default added from our Apache HttpClient. I checked the source code, there is currently no way of disabling this. Even if you invoke HttpClentBuilder#setUserAgent(null), it'd overridden with the default one. The only workaround I see is to call HttpClentBuilder#addInterceptorLast(HttpRequestInterceptor) which would remove this header actively. This could be done from JMeter with a JMeter property. I'd prefer a reasonable solution in HttpClient directly, e.g., HttpClentBuilder#disableDefaultUserAgent(). Please a issue with https://issues.apache.org/jira/browse/HTTPCLIENT.
https://issues.apache.org/jira/browse/HTTPCLIENT-1952
As soon as the upstream ticket is resolved we can introduce a system property to disable this header.
Hello, What about considering that empty value for Header means "remove header" ? Regards
An empty header is a valid use case. The ABNF in RFC7230 also defines the field value as field-value = *( field-content / obs-fold ) which would indicate that empty values are valid.
Issue fixed in httpclient 4.5.7
(In reply to Philippe Mouawad from comment #6) > Issue fixed in httpclient 4.5.7 Boy, you are fast. You must have been lurking for my merge ;-)
(In reply to Michael Osipov from comment #7) > (In reply to Philippe Mouawad from comment #6) > > Issue fixed in httpclient 4.5.7 > > Boy, you are fast. You must have been lurking for my merge ;-) Hello Michael, They call me Lucky Luke, the man who comments before his shadow :-) On an another topic, the 4.5.7 would not be released before Q1, we'll probably be releasing a JMeter 5.1 before without any possibility to fix this issue. Regards
(In reply to Philippe Mouawad from comment #8) > (In reply to Michael Osipov from comment #7) > > (In reply to Philippe Mouawad from comment #6) > > > Issue fixed in httpclient 4.5.7 > > > > Boy, you are fast. You must have been lurking for my merge ;-) > > Hello Michael, > > They call me Lucky Luke, the man who comments before his shadow :-) > > On an another topic, the 4.5.7 would not be released before Q1, we'll > probably be releasing a JMeter 5.1 before without any possibility to fix > this issue. > > Regards You should kindly request on the dev mailing list release for Jan. I guess neither Oleg noch Gary will mind. This is an important issue.
(In reply to Michael Osipov from comment #9) > (In reply to Philippe Mouawad from comment #8) > > (In reply to Michael Osipov from comment #7) > > > (In reply to Philippe Mouawad from comment #6) > > > > Issue fixed in httpclient 4.5.7 > > > > > > Boy, you are fast. You must have been lurking for my merge ;-) > > > > Hello Michael, > > > > They call me Lucky Luke, the man who comments before his shadow :-) > > > > On an another topic, the 4.5.7 would not be released before Q1, we'll > > probably be releasing a JMeter 5.1 before without any possibility to fix > > this issue. > > > > Regards > > You should kindly request on the dev mailing list release for Jan. I guess > neither Oleg noch Gary will mind. This is an important issue. Hello Michael, Already done for another issue . You can have a look at mailing list. Regards
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
This issue has been migrated to GitHub: https://github.com/apache/jmeter/issues/4940