You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by "Martin Schreiber (JIRA)" <ji...@apache.org> on 2014/07/09 16:31:04 UTC
[jira] [Commented] (HTTPCLIENT-1526) No User-Agent set in tunneled
proxy connection
[ https://issues.apache.org/jira/browse/HTTPCLIENT-1526?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14056292#comment-14056292 ]
Martin Schreiber commented on HTTPCLIENT-1526:
----------------------------------------------
I found a way to set the user agent in all requests:
{code}
HttpClientBuilder builder = HttpClientBuilder.custom();
builder.setRequestExecutor(new HttpRequestExecutor() {
@Override
public void preProcess(final HttpRequest request, final HttpProcessor processor, final HttpContext context) throws HttpException, IOException {
if (!request.containsHeader(HTTP.USER_AGENT)) {
request.addHeader(new BasicHeader(HTTP.USER_AGENT, "Some user agent"));
}
super.preProcess(request, processor, context);
}
});
{code}
> No User-Agent set in tunneled proxy connection
> ----------------------------------------------
>
> Key: HTTPCLIENT-1526
> URL: https://issues.apache.org/jira/browse/HTTPCLIENT-1526
> Project: HttpComponents HttpClient
> Issue Type: Bug
> Components: HttpClient
> Affects Versions: 4.3.4
> Environment: Win7, jdk 1.7
> Reporter: Martin Schreiber
>
> When making a connection over a proxy, the HttpClient does not send a User-Agent header to authenticate with the proxy. This is problematic as our proxy only allows connection with a User-Agent set.
> The deprecated DefaultHttpClient does send the User-Agent info also for the proxy authentication.
--
This message was sent by Atlassian JIRA
(v6.2#6252)
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org