[ 
https://issues.apache.org/jira/browse/HTTPCLIENT-1087?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13034753#comment-13034753
 ] 

David Gibbs commented on HTTPCLIENT-1087:
-----------------------------------------

Seems to work OK, thanks.

> Proxy authentication error: Unexpected state: MSG_TYPE3_GENERATED when using 
> NTLM authentication
> ------------------------------------------------------------------------------------------------
>
>                 Key: HTTPCLIENT-1087
>                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-1087
>             Project: HttpComponents HttpClient
>          Issue Type: Bug
>          Components: HttpClient
>    Affects Versions: 4.1.1
>         Environment: Client app running Java 6 on a Win 7 X64 box, proxy 
> Squid 2.7 running on a Win7 machine.
>            Reporter: David Gibbs
>             Fix For: 4.1.2
>
>         Attachments: HTTPCLIENT-1087-take2.patch, HTTPCLIENT-1087.patch, 
> wire-debug-1.log, wire-debug.log
>
>
> Trying to connect to a website that requires basic authentication through a 
> proxy that requires NTLM authentication.
> Proxy authentication fails with "Proxy authentication error: Unexpected 
> state: MSG_TYPE3_GENERATED".
> Full wire log attached.  Code to replicate problem follows:
>     private void execute() throws HttpException, IOException {
>       
>       URL targetUrl = new URL(TARGET_URL);
>       
>         DefaultHttpClient httpclient = new DefaultHttpClient();
>         HttpHost targetHost = new HttpHost(targetUrl.getHost()); 
>         HttpHost proxyHost = new HttpHost(PROXY_HOST, PROXY_PORT); 
>         
>         httpclient.getParams().setParameter(ConnRoutePNames.DEFAULT_PROXY, 
>                       proxyHost);
>         CredentialsProvider credProvider = 
> httpclient.getCredentialsProvider();
>         
>         Credentials proxyCredentials = new NTCredentials(PROXY_USER, 
>                       PROXY_PASSWORD, PROXY_MACHINE, PROXY_DOMAIN);
>         AuthScope proxyAuthScope = new AuthScope(proxyHost.getHostName(),
>                       proxyHost.getPort());
>         
>         credProvider.setCredentials(proxyAuthScope, proxyCredentials);
>         
>         Credentials targetCredentials = new UsernamePasswordCredentials(
>                       TARGET_USER, TARGET_PASSWORD);
>         AuthScope targetAuthScope = new AuthScope(targetHost.getHostName(),
>                       targetHost.getPort());
>         
>         credProvider.setCredentials(targetAuthScope, targetCredentials);
>       
>         HttpGet httpget = new HttpGet(targetUrl.getPath());
>         HttpResponse response = httpclient.execute(targetHost, httpget);
>         
>         System.out.println("response = " + response);
>         
>        
>     }

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to