On Wed, 2010-09-08 at 12:03 +0200, MASTRELLA STEFANO wrote:
> I'd like to goggle around via the httpclient library through a proxy
> with a NTLM authentication scheme, so I've just copied the example in
>
...
> The configuration of the HttpClient is as in the following
>
> public class HttpTest
> {
> public void doGoogling() throws ClientProtocolException, IOException
> {
> BasicConfigurator.configure();
>
> DefaultHttpClient httpclient = new DefaultHttpClient();
>
> httpclient.getAuthSchemes().register("ntlm", new
> NTLMSchemeFactory());
>
> /*
> * Proxy configuration
> */
> HttpHost proxy = new HttpHost("myproxy.it", 8080);
> httpclient.getParams().setParameter(ConnRoutePNames.DEFAULT_PROXY,
> proxy);
>
> /*
> * credentials: the username and the workstation are the same
> because
> * the program run from the user owner of the workstation
> */
> NTCredentials creds = new NTCredentials("myusername", "mypassw",
> "myusername", "mydomain");
> AuthScope scope = new AuthScope("google.com", AuthScope.ANY_PORT);
>
> httpclient.getCredentialsProvider().setCredentials(scope, creds);
>
Auth scope is wrong. The host name should be that of the proxy not of
the target.
Oleg
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]