Bug 32667 - setting proxypassword and proxyuser in setProxy task does not work
Summary: setting proxypassword and proxyuser in setProxy task does not work
Status: RESOLVED FIXED
Alias: None
Product: Ant
Classification: Unclassified
Component: Optional Tasks (show other bugs)
Version: 1.6.2
Hardware: All Linux
: P2 major (vote)
Target Milestone: 1.6.3
Assignee: Ant Notifications List
URL:
Keywords: PatchAvailable
: 37595 (view as bug list)
Depends on:
Blocks:
 
Reported: 2004-12-13 16:43 UTC by Joachim Zierhold
Modified: 2008-02-22 12:18 UTC (History)
1 user (show)



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Joachim Zierhold 2004-12-13 16:43:36 UTC
The setProxy task sets the properties "http.proxyUser" and "http.proxyPassword"
in order to provide user and password for proxy authentication.
With JDK 1.4.2_0x on Linux this does not work (I think this is also reported in
Suns bug database. In JDK 1.3 it seems to work). The workaround with using the
Authenticator class works on this platform. Following the javadoc, it should be
usable since JDK 1.2.


diff -rb ./src/main/org/apache/tools/ant/taskdefs/optional/net/SetProxy.java
../apache-ant-1.6.2/src/main/org/apache/tools/ant/taskdefs/optional/net/SetProxy.java
25a26
> import java.net.*;
196a198,199
>                     Authenticator.setDefault(
>                        new HttpAuthenticateProxy( proxyUser, proxyPassword ));
221a225,226
>                     Authenticator.setDefault(
>                        new HttpAuthenticateProxy( proxyUser, proxyPassword ));
240a246,261
>       public class HttpAuthenticateProxy extends Authenticator
>          {
>          String user, password;
>
>          public HttpAuthenticateProxy( String user, String password )
>             {
>             this.user = user;
>             this.password = password;
>             }
>
>          protected PasswordAuthentication getPasswordAuthentication()
>             {
>             return new PasswordAuthentication(
>                user, password.toCharArray());
>             }
>          }
246c267
<                 + (proxyHost != null ? proxyHost : "''")
---
>                 + proxyUser + ":" + proxyPassword + "@" + (proxyHost != null ?
proxyHost : "''")
Comment 1 Stefan Bodewig 2004-12-21 15:09:56 UTC
fixed in CVS, thanks.
Comment 2 Steve Loughran 2006-06-27 18:33:39 UTC
*** Bug 37595 has been marked as a duplicate of this bug. ***