You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by "Giacomo Boccardo (JIRA)" <ji...@apache.org> on 2015/01/14 17:30:38 UTC

[jira] [Updated] (HTTPCLIENT-1598) Native Windows Negotiate/NTLM via JNA + 407 Proxy Authentication Required

     [ https://issues.apache.org/jira/browse/HTTPCLIENT-1598?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Giacomo Boccardo updated HTTPCLIENT-1598:
-----------------------------------------
    Description: 
I'm trying to use the native Windows NTLM negotiation as describe at http://svn.apache.org/repos/asf/httpcomponents/httpclient/trunk/httpclient-win/src/examples/org/apache/http/examples/client/win/ClientWinAuth.java
but I need to explicitly set a proxy.

{code:java}
if (!WinHttpClients.isWinAuthAvailable()) {
	System.out.println("Integrated Win auth is not supported!!!");
}

HttpClientBuilder httpClientBuilder = WinHttpClients.custom();

HttpHost httpProxy = new HttpHost("proxyserver.example.com", 3128);

httpClientBuilder.setProxy(httpProxy);
CloseableHttpClient httpclient = httpClientBuilder.build();

try {
	HttpGet httpget = new HttpGet("http://www.google.it");

	System.out.println("Executing request " + httpget.getRequestLine());
	CloseableHttpResponse response = httpclient.execute(httpget);
	try {
		System.out.println("----------------------------------------");
		System.out.println(response.getStatusLine());
		EntityUtils.consume(response.getEntity());
	} finally {
		response.close();
	}
} finally {
	httpclient.close();
}
{code}

The response is something like

{{HTTP/1.0 407 Proxy Authentication Required}}


I'd like to add attachments, but I can't find a way to do it.

What's wrong?


  was:
I'm trying to use the native Windows NTLM negotiation as describe at http://svn.apache.org/repos/asf/httpcomponents/httpclient/trunk/httpclient-win/src/examples/org/apache/http/examples/client/win/ClientWinAuth.java
but I need to explicitly set a proxy.

{code:java}
if (!WinHttpClients.isWinAuthAvailable()) {
	System.out.println("Integrated Win auth is not supported!!!");
}

HttpClientBuilder httpClientBuilder = WinHttpClients.custom();

HttpHost httpProxy = new HttpHost("proxyserver.example.com", 3128);

httpClientBuilder.setProxy(httpProxy);
CloseableHttpClient httpclient = httpClientBuilder.build();

try {
	HttpGet httpget = new HttpGet("http://www.google.it");

	System.out.println("Executing request " + httpget.getRequestLine());
	CloseableHttpResponse response = httpclient.execute(httpget);
	try {
		System.out.println("----------------------------------------");
		System.out.println(response.getStatusLine());
		EntityUtils.consume(response.getEntity());
	} finally {
		response.close();
	}
} finally {
	httpclient.close();
}
{code}

The response is something like
{{
HTTP/1.0 407 Proxy Authentication Required
}}

I'd like to add attachments, but I can't find a way to do it.

What's wrong?



> Native Windows Negotiate/NTLM via JNA + 407 Proxy Authentication Required
> -------------------------------------------------------------------------
>
>                 Key: HTTPCLIENT-1598
>                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-1598
>             Project: HttpComponents HttpClient
>          Issue Type: Bug
>          Components: HttpAuth
>    Affects Versions: 4.4 Beta1
>         Environment: Windows 8
>            Reporter: Giacomo Boccardo
>              Labels: 407, jna, native, ntlm
>
> I'm trying to use the native Windows NTLM negotiation as describe at http://svn.apache.org/repos/asf/httpcomponents/httpclient/trunk/httpclient-win/src/examples/org/apache/http/examples/client/win/ClientWinAuth.java
> but I need to explicitly set a proxy.
> {code:java}
> if (!WinHttpClients.isWinAuthAvailable()) {
> 	System.out.println("Integrated Win auth is not supported!!!");
> }
> HttpClientBuilder httpClientBuilder = WinHttpClients.custom();
> HttpHost httpProxy = new HttpHost("proxyserver.example.com", 3128);
> httpClientBuilder.setProxy(httpProxy);
> CloseableHttpClient httpclient = httpClientBuilder.build();
> try {
> 	HttpGet httpget = new HttpGet("http://www.google.it");
> 	System.out.println("Executing request " + httpget.getRequestLine());
> 	CloseableHttpResponse response = httpclient.execute(httpget);
> 	try {
> 		System.out.println("----------------------------------------");
> 		System.out.println(response.getStatusLine());
> 		EntityUtils.consume(response.getEntity());
> 	} finally {
> 		response.close();
> 	}
> } finally {
> 	httpclient.close();
> }
> {code}
> The response is something like
> {{HTTP/1.0 407 Proxy Authentication Required}}
> I'd like to add attachments, but I can't find a way to do it.
> What's wrong?



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org