Details
Description
Supplying the proxy host, port, username and password in the build.properties file as specified in the documentation still failed to get through the proxy server where I work.
HttpUtils sets the default Authenticator as I'd expect to handle such authentication challenges, however, I added a line of logging to the getPasswordAuthentication() method and noticed that is was not being called under our environment. Why this is the case, I cannot honestly say - however, I have noticed that a few articles on the web mention how people could not get Authenticator to work.
Reading further, a few sites recommended that the "Proxy-Authentication" header is used, and I noticed that the "Authentication" header is already being used in HttpUtils (presumably for pre java 1.2 support). Adding similar handling for "Proxy-Authentication" header allowed maven to successfully connect through our proxy server.
I've provided a patch below for this, should it be decided its a reasonable addition.
---------------- PATCH START ----------------
Index: HttpUtils.java
===================================================================
RCS file: /home/cvspublic/maven/src/java/org/apache/maven/util/HttpUtils.java,v
retrieving revision 1.28
diff -c -r1.28 HttpUtils.java
-
-
- HttpUtils.java 27 Oct 2003 16:33:11 -0000 1.28
- HttpUtils.java 6 Feb 2004 09:48:46 -0000
***************
- 284,289 ****
- 284,312 ----
throw new Exception( "Not authorized." );
}
}
+ // add proxy authentication header if required
+ if ( proxyUserName != null || proxyPassword != null )
+Unknown macro: {+ String up = proxyUserName + "}
-
// REVISIT: at this point even non HTTP connections may support the
// if-modified-since behaviour - we just check the date of the
----------------- PATCH END -----------------
I'm not sure it's work for other proxy, so, I'll wait some tests from other users before apply it.