Menu

#233 Proxy Authentication Fail

v2.0
closed-fixed
None
5
2007-03-04
2006-11-15
Jorge G.
No

I tried to get a web page through a proxy server who require user authentication.
Although I set correctly the user and the password in the ConnectionManager with the methods setProxyUser() and setProxyPassword() the proxy always report the following error:

407 Proxy Authentication Required.

I am using HTMLParser Version 1.6 (Release Build Jun 10, 2006) and Squid Proxy Server.

Using Ethereal software I compared the messages sent by HTMLParser and Microsoft Internet Explorer during the proxy authentication and I found a difference that you can see

HTMLParser: Proxy-Authorization: Z2VsbWV0dGk6Z2VsbWV0dGk=\r\n
IE: Proxy-Authorization: Basic Z2VsbWV0dGk6Z2VsbWV0dGk=\r\n

Solution:

I modified the method ‘openConnection’ in the ‘ConnectionManager’ class adding the string ‘Basic ‘ as I show in the following code:

// set the proxy name and password
if ((null != getProxyUser ())
&& (null != getProxyPassword ()))
{
auth = getProxyUser () + ":" + getProxyPassword ();
encoded = encode (auth.getBytes("ISO-8859-1"));
ret.setRequestProperty ("Proxy-Authorization", "Basic " + encoded);
}

After that I rebuild the software and I tested it with success.

I attach the file modified.

Regards.

Jorge Gelmetti

Discussion

  • Jorge G.

    Jorge G. - 2006-11-15

    ConnectionManager modified

     
  • Derrick Oswald

    Derrick Oswald - 2007-03-04

    Logged In: YES
    user_id=605407
    Originator: NO

    Add "Basic " prefix to Proxy-Authorization request property.

     
  • Derrick Oswald

    Derrick Oswald - 2007-03-04
    • milestone: --> v2.0
    • assigned_to: nobody --> derrickoswald
    • status: open --> closed-fixed
     

Log in to post a comment.

MongoDB Logo MongoDB