DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=31358>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=31358

HTTP Get Task does not support basic proxy authentication

           Summary: HTTP Get Task does not support basic proxy
                    authentication
           Product: Ant
           Version: 1.6.2
          Platform: Other
        OS/Version: Other
            Status: NEW
          Severity: Enhancement
          Priority: Other
         Component: Core
        AssignedTo: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]


I propose to add two properties (proxyUser, proxyPassword) to the Get task,
which can be used for basic proxy authentication. For this, the execute method
needs some additional lines:

if (proxyUname != null || proxyPword != null) {
    String up = proxyUname + ":" + proxyPword;
    String encoding;
    // check to see if sun's Base64 encoder is available.
    try {
        Object encoder =
                Class.forName("sun.misc.BASE64Encoder").newInstance();
        encoding = (String)
                encoder.getClass().getMethod("encode", new Class[] 
{byte[].class})
                .invoke(encoder, new Object[] {up.getBytes()});

    } catch (Exception ex) { // sun's base64 encoder isn't available
        Base64Converter encoder = new Base64Converter();
        encoding = encoder.encode(up.getBytes());
    }
    connection.setRequestProperty("Proxy-Authorization", "Basic " + encoding);
}

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to