hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "David Gibbs (JIRA)" <j...@apache.org>
Subject [jira] [Created] (HTTPCLIENT-1087) Proxy authentication error: Unexpected state: MSG_TYPE3_GENERATED when using NTLM authentication
Date Fri, 13 May 2011 14:31:47 GMT
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
         Attachments: 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: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


Mime
View raw message