Hi,

can somebody direct me where to look for problem?

NTLM Proxy is in question, DEBUG log follows:

2006-08-04 16:31:00.293 DEBUG [http-80-Processor25:] -
httpclient.wire.header: << "Connection: Keep-Alive[\r][\n]"
2006-08-04 16:31:00.293 DEBUG [http-80-Processor25:] -
httpclient.wire.header: << "Proxy-Connection: Keep-Alive[\r][\n]"
2006-08-04 16:31:00.293 DEBUG [http-80-Processor25:] -
httpclient.wire.header: << "Pragma: no-cache[\r][\n]"
2006-08-04 16:31:00.293 DEBUG [http-80-Processor25:] -
httpclient.wire.header: << "Cache-Control: no-cache[\r][\n]"
2006-08-04 16:31:00.293 DEBUG [http-80-Processor25:] -
httpclient.wire.header: << "Content-Type: text/html[\r][\n]"
2006-08-04 16:31:00.293 DEBUG [http-80-Processor25:] -
httpclient.wire.header: << "Content-Length: 0[\r][\n]"
2006-08-04 16:31:00.309 DEBUG [http-80-Processor25:] -
httpclient.wire.header: >> "HEAD
http://repo1.maven.org/maven2/org/apache/maven/plugins/maven-resources-plugin/maven-metadata.xml?HTTP/1.1[\r][\n]";
2006-08-04 16:31:00.309 DEBUG [http-80-Processor25:] -
httpclient.wire.header: >> "User-Agent: Jakarta
Commons-HttpClient/3.0.1[\r][\n]"
2006-08-04 16:31:00.309 DEBUG [http-80-Processor25:] -
httpclient.wire.header: >> "Proxy-Connection: Keep-Alive[\r][\n]"
2006-08-04 16:31:00.309 DEBUG [http-80-Processor25:] -
httpclient.wire.header: >> "Proxy-Authorization: NTLM
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx[\r][\n]"
2006-08-04 16:31:00.309 DEBUG [http-80-Processor25:] -
httpclient.wire.header: >> "Host: repo1.maven.org[\r][\n]"
2006-08-04 16:31:00.309 DEBUG [http-80-Processor25:] -
httpclient.wire.header: >> "[\r][\n]"
2006-08-04 16:31:00.387 DEBUG [http-80-Processor25:] -
httpclient.wire.header: << "HTTP/1.1 407 Proxy Authentication Required ( The
ISA Server requires authorization to fulfill the request. Access to the Web
Proxy service is denied. )[\r][\n]"
2006-08-04 16:31:00.387 DEBUG [http-80-Processor25:] -
httpclient.wire.header: << "Via: 1.1 PROXYNAME[\r][\n]"
2006-08-04 16:31:00.387 DEBUG [http-80-Processor25:] -
httpclient.wire.header: << "Proxy-Authenticate: Negotiate[\r][\n]"
2006-08-04 16:31:00.387 DEBUG [http-80-Processor25:] -
httpclient.wire.header: << "Proxy-Authenticate: Kerberos[\r][\n]"
2006-08-04 16:31:00.387 DEBUG [http-80-Processor25:] -
httpclient.wire.header: << "Proxy-Authenticate: NTLM[\r][\n]"
2006-08-04 16:31:00.387 DEBUG [http-80-Processor25:] -
httpclient.wire.header: << "Proxy-Authenticate: Basic
realm="proxyname"[\r][\n]"
2006-08-04 16:31:00.387 DEBUG [http-80-Processor25:] -
httpclient.wire.header: << "Connection: close[\r][\n]"
2006-08-04 16:31:00.387 DEBUG [http-80-Processor25:] -
httpclient.wire.header: << "Proxy-Connection: close[\r][\n]"
2006-08-04 16:31:00.387 DEBUG [http-80-Processor25:] -
httpclient.wire.header: << "Pragma: no-cache[\r][\n]"
2006-08-04 16:31:00.387 DEBUG [http-80-Processor25:] -
httpclient.wire.header: << "Cache-Control: no-cache[\r][\n]"
2006-08-04 16:31:00.387 DEBUG [http-80-Processor25:] -
httpclient.wire.header: << "Content-Type: text/html[\r][\n]"
2006-08-04 16:31:00.387 DEBUG [http-80-Processor25:] -
httpclient.wire.header: << "Content-Length: 4107[\r][\n]"
2006-08-04 16:31:00.387 INFO [http-80-Processor25:] -
org.apache.commons.httpclient.HttpMethodDirector: Failure authenticating
with NTLM <any realm>@proxyname:8080


The source doing this:

           httpRetryHandler = new
DefaultHttpMethodRetryHandler(retrievalRetryCount, false);
           httpClient = new HttpClient(new
MultiThreadedHttpConnectionManager());
           httpClient.getParams
().setConnectionManagerTimeout(getConnectionTimeout());
           httpConfiguration = httpClient.getHostConfiguration();

           if (getProxyHost() != null) {
               logger.info("... proxy setup with host " + getProxyHost() +
", port " + getProxyPort());
               httpConfiguration.setProxy(getProxyHost(), getProxyPort());

               httpConfiguration.setHost(getProxyNtlmHost());

                httpClient.getState().setProxyCredentials(
                               AuthScope.ANY,
                               new NTCredentials(getProxyUsername(),
getProxyPassword(), getProxyNtlmHost(),
                                       getProxyNtlmDomain()));

           }
...
...
        resultCode = httpClient.executeMethod(httpConfiguration, method);



Is ISA Proxy server supported by HttpClient (3.0.1)?


------------------------------------------------------------

The same proxy and HttpClient give me the following response with a little
test program:

Aug 6, 2006 12:01:07 PM
org.apache.commons.httpclient.auth.AuthChallengeProcessor
selectAuthScheme
INFO: Basic authentication scheme selected
org.apache.commons.httpclient.ProtocolException: The
server repo1.maven.org failed to respond with a valid
HTTP response
      at
org.apache.commons.httpclient.HttpMethodBase.readStatusLine(
HttpMethodBase.java:1846)
      at
org.apache.commons.httpclient.HttpMethodBase.readResponse(
HttpMethodBase.java:1590)
      at
org.apache.commons.httpclient.HttpMethodBase.execute(HttpMethodBase.java
:995)
      at
org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(
HttpMethodDirector.java:397)
      at
org.apache.commons.httpclient.HttpMethodDirector.executeMethod(
HttpMethodDirector.java:170)
      at
org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:396)
      at
org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:324)
      at
httpclient.BasicAuthTest.main(BasicAuthTest.java:53)
-------------------------------------------------

Here is the program
-----------------------------


package httpclient;

import java.util.ArrayList;
import java.util.List;
import java.util.logging.Logger;

import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.UsernamePasswordCredentials;
import org.apache.commons.httpclient.auth.AuthPolicy;
import org.apache.commons.httpclient.auth.AuthScope;
import org.apache.commons.httpclient.methods.PostMethod;

public class BasicAuthTest

{

public static void main(String[] args)

  {
      try
      {
          HttpClient client = new HttpClient();

          client.getHostConfiguration().setProxy("proxyname",8080);

          List authPrefs = new ArrayList(2);

           authPrefs.add(AuthPolicy.DIGEST);

          authPrefs.add(AuthPolicy.BASIC);

          client.getParams().setParameter(AuthPolicy.AUTH_SCHEME_PRIORITY
,authPrefs);

          client.getState().setProxyCredentials(new AuthScope("proxyname",
8080,"proxyname"),
                              new UsernamePasswordCredentials("username",
"password"));

          PostMethod method = new
PostMethod("http://repo1.maven.org/";);

          System.out.println("Connecting...");

          int responseCode =
client.executeMethod(method);

          System.out.println("Responfiltered= " +
responseCode);

      }

      catch (Exception e)

      {

          e.printStackTrace();
     }


(Sorry for bad formatting and the lack of wire log) - it seems to me that it
"get thru" the proxy using BASIC auth but there was some problem with
response....

Thanx in advance,
~t~

Reply via email to