hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Fabien Guironnet <fg.j...@free.fr>
Subject Re: NTLM Proxy Authentication : still receiving 407
Date Fri, 25 Apr 2003 18:22:37 GMT
  Sorry I've forgotten...
I must add the header "Proxy-Connection: Keep-Alive" to my method before 
execute it. I don't know if we must do this for all NTLM proxies or just 
for Squid...

    Fabien



Fabien Guironnet wrote:

>  Adrian,
>
> I'm using Squid for NTLM auth because my office use it so we can only 
> use MS products; that's why I make tests with Squid.
> But I don't think it's a bug from Squid because I've tried with other 
> NTLM clients.
> I think I've resolved my problem!
> The problem is that connection with the proxy was closed.
> I've patched the method "shouldCloseConnection()" of the class 
> "HttpMethodBase.java" with the patch found in the bug description 
> (*Bug#:*19226 
> <http://nagoya.apache.org/bugzilla/show_bug.cgi?id=19226>) 
> (http://nagoya.apache.org/bugzilla/showattachment.cgi?attach_id=5967).
> With this patch my program still not work, because the patch just 
> resolve the problem of connection with a server and not with a proxy; 
> I've add test for "proxy-connection" and now it seems to work.
>
> ======================================================
>  protected boolean shouldCloseConnection() {
>        Header connectionHeader = getResponseHeader("connection");
>
>        // ------ /!\ ------
>        if (connectionHeader == null) {
>            // no header for "connection" : try with "proxy-connection"
>            connectionHeader = getResponseHeader("proxy-connection");
>        }
>        // ------ /!\ ------
>              // handle the connection header value, if present
>        if (connectionHeader != null) {
>            if (connectionHeader.getValue().equalsIgnoreCase("close")) {
>                LOG.debug("Should close connection since \"Connection: 
> close\" was found.");
>                return true;
>            } else if 
> (connectionHeader.getValue().equalsIgnoreCase("keep-alive")) {
>                LOG.debug("Should NOT close connection since 
> \"Connection: keep-alive\" "
>                    + "was found.");
>                return false;
>            } else {
>                LOG.debug("Unknown \"Connection\" header value: " + 
> connectionHeader.getValue()
>                    + ". Resorting to protocol version default close 
> policy.");
>            }
>        }
>
>        // missing or invalid connection header, do the default
>        if (http11) {
>            LOG.debug("Should NOT close connection, using HTTP/1.1.");
>        } else {
>            LOG.debug("Should close connection, using HTTP/1.0.");
>        }
>              return !http11;
>    }
> ======================================================
>
> Hope that can help you,
>
>    Fabien
>
>
>
> Adrian Sutton wrote:
>
>> Hmm, that sounds a lot like a bug in the proxy server.  I have to  
>> wonder why you're using NTLM authentication with SQUID but anyway...
>>
>> My first inclination on problems with HttpClient are notoriously  
>> inaccurate, so it would be good if you could provide me with a full  
>> wire log of the transaction as per the instructions at  
>> http://jakarta.apache.org/commons/httpclient/logging.html
>>
>> There are so many NTLM complaints that have come through today that  
>> there must be something wrong with NTLM in HttpClient though.  The 
>> log  should tell us more.
>>
>> Regards,
>>
>> Adrian Sutton.
>>
>> On Friday, April 25, 2003, at 04:19  AM, Fabien Guironnet wrote:
>>
>>>  Hello,
>>>
>>> I'm trying to authenticate with an NTLM Proxy server (SQUID 2.5), 
>>> but  I still get the error message :
>>> 24 avr. 2003 19:39:23 org.apache.commons.httpclient.HttpMethodBase  
>>> processAuthenticationResponse
>>> INFO: Already tried to authenticate to  
>>> "www.google.com#TlRMTVNTUAACAAAABAAEACgAAACCgkEAu3QkmX3Fo24AAAAAAAAAAEx 
>>> ZT04=" but still receiving 407.
>>>
>>> I don't think the problem come from Squid because I can use IE and  
>>> NTLM Authorization Proxy Server 0.9.7 (Python) from Dmitry A. > 
>>> Rozmanov.
>>> I've tested the 3 NTLM messages generated by HTTPClient (with NTLM  
>>> Authorization Proxy Server) and they seems to be OK.
>>> Can the problem come from a connection that isn't keeped alive? or 
>>> I  don't use the HTTPClient correctly?
>>>
>>> Here is my code (I've tried HTTPClient package 2.0 Alpha 3 
>>> (20030225)  and the nightly source drop from 20030423) :
>>> ///////////////////////// BEGIN ///////////////////////////////
>>>
>>> import org.apache.commons.httpclient.*;
>>> import org.apache.commons.httpclient.methods.*;
>>> import java.io.IOException;
>>>
>>> public class Test{
>>>
>>>    public static void main(String[] arg) {          HttpState state 
>>> =  new HttpState();
>>>        HttpClient client = new HttpClient();
>>>        NTCredentials cred = new NTCredentials("nom_utilisateur",  
>>> "mot_passe", "192.168.0.1", "DOMAINE");
>>>        HostConfiguration host = new HostConfiguration();
>>>        HttpMethod method = new GetMethod();
>>>              host.setProxy("192.168.0.2", 3128);
>>>        host.setHost("www.google.com", 80, "http");
>>>        client.setHostConfiguration(host);
>>>        client.getState().setProxyCredentials(null, cred);
>>>                      try {
>>>            client.executeMethod(method);
>>>            System.out.println(method.getStatusCode() + "\n" +  
>>> method.getResponseBodyAsString());
>>>        } catch (IOException e) {
>>>            System.out.println("IOException : " + e.getMessage());
>>>            return;
>>>        }
>>>    }
>>> }
>>>
>>> /////////////////////////////// END /////////////////////////////////
>>>
>>>
>>>
>>> Thanks for your help!
>>>
>>>    Fabien
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail:  
>>> commons-httpclient-dev-unsubscribe@jakarta.apache.org
>>> For additional commands, e-mail:  
>>> commons-httpclient-dev-help@jakarta.apache.org
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: 
>> commons-httpclient-dev-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: 
>> commons-httpclient-dev-help@jakarta.apache.org
>>
>>
>>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: 
> commons-httpclient-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: 
> commons-httpclient-dev-help@jakarta.apache.org
>
>
>




Mime
View raw message