corrected missing filename in debug output
[org.ibex.core.git] / src / org / ibex / HTTP.java
index 1463897..b2a6b76 100644 (file)
@@ -268,7 +268,6 @@ public class HTTP {
         if (Log.verbose) Log.info(this, "evaluating PAC script");
         String pac = null;
         try {
-            org.ibex.js.JSArray args = new org.ibex.js.JSArray();
             Object obj = pacFunc.call(url.toString(), url.getHost(), null, null, 2);
             if (Log.verbose) Log.info(this, "  PAC script returned \"" + obj + "\"");
             pac = obj.toString();
@@ -649,8 +648,6 @@ public class HTTP {
     /** encapsulates most of the proxy logic; some is shared in HTTP.java */
     public static class Proxy {
         
-        public Proxy() { }
-        
         public String httpProxyHost = null;                  ///< the HTTP Proxy host to use
         public int httpProxyPort = -1;                       ///< the HTTP Proxy port to use
         public String httpsProxyHost = null;                 ///< seperate proxy for HTTPS
@@ -770,7 +767,7 @@ public class HTTP {
             static public Semaphore waitingForUser = new Semaphore();
 
             public static synchronized void getPassword(final String realm, final String style,
-                                                        final String proxyIP, String oldAuth) {
+                                                        final String proxyIP, String oldAuth) throws IOException {
 
                 // this handles cases where multiple threads hit the proxy auth at the same time -- all but one will block on the
                 // synchronized keyword. If 'authorization' changed while the thread was blocked, it means that the user entered
@@ -779,9 +776,9 @@ public class HTTP {
                 if (authorization != oldAuth) return;
                 if (Log.on) Log.info(Authorization.class, "displaying proxy authorization dialog");
                 Scheduler.add(new Scheduler.Task() {
-                        public void perform() throws Exception {
+                        public void perform() throws IOException, JSExn {
                             Box b = new Box();
-                            Template t = Template.buildTemplate(Stream.getInputStream((JS)Main.builtin.get("org/ibex/builtin/proxy_authorization.ibex")), new Ibex(null));
+                            Template t = Template.buildTemplate("org/ibex/builtin/proxy_authorization.ibex", Stream.getInputStream((JS)Main.builtin.get("org/ibex/builtin/proxy_authorization.ibex")), new Ibex(null));
                             t.apply(b);
                             b.put("realm", realm);
                             b.put("proxyIP", proxyIP);
@@ -936,7 +933,7 @@ public class HTTP {
              * @return The NTLM Response.
              */
             public static byte[] getNTLMResponse(String password, byte[] challenge)
-                throws Exception {
+                throws UnsupportedEncodingException {
                 byte[] ntlmHash = ntlmHash(password);
                 return lmResponse(ntlmHash, challenge);
             }
@@ -951,7 +948,7 @@ public class HTTP {
              * @return The LM Response.
              */
             public static byte[] getLMResponse(String password, byte[] challenge)
-                throws Exception {
+                {
                 byte[] lmHash = lmHash(password);
                 return lmResponse(lmHash, challenge);
             }
@@ -973,7 +970,7 @@ public class HTTP {
              */
             public static byte[] getNTLMv2Response(String target, String user,
                                                    String password, byte[] targetInformation, byte[] challenge,
-                                                   byte[] clientChallenge) throws Exception {
+                                                   byte[] clientChallenge) throws UnsupportedEncodingException {
                 byte[] ntlmv2Hash = ntlmv2Hash(target, user, password);
                 byte[] blob = createBlob(targetInformation, clientChallenge);
                 return lmv2Response(ntlmv2Hash, blob, challenge);
@@ -994,7 +991,7 @@ public class HTTP {
              */
             public static byte[] getLMv2Response(String target, String user,
                                                  String password, byte[] challenge, byte[] clientChallenge)
-                throws Exception {
+                throws UnsupportedEncodingException {
                 byte[] ntlmv2Hash = ntlmv2Hash(target, user, password);
                 return lmv2Response(ntlmv2Hash, clientChallenge, challenge);
             }
@@ -1012,7 +1009,7 @@ public class HTTP {
              * the client challenge, null-padded to 24 bytes.
              */
             public static byte[] getNTLM2SessionResponse(String password,
-                                                         byte[] challenge, byte[] clientChallenge) throws Exception {
+                                                         byte[] challenge, byte[] clientChallenge) throws UnsupportedEncodingException {
                 byte[] ntlmHash = ntlmHash(password);
                 MD5Digest md5 = new MD5Digest();
                 md5.update(challenge, 0, challenge.length);
@@ -1032,7 +1029,7 @@ public class HTTP {
              * @return The LM Hash of the given password, used in the calculation
              * of the LM Response.
              */
-            private static byte[] lmHash(String password) throws Exception {
+            private static byte[] lmHash(String password) {
                 /*
                 byte[] oemPassword = password.toUpperCase().getBytes("US-ASCII");
                 int length = java.lang.Math.min(oemPassword.length, 14);
@@ -1062,7 +1059,7 @@ public class HTTP {
              * @return The NTLM Hash of the given password, used in the calculation
              * of the NTLM Response and the NTLMv2 and LMv2 Hashes.
              */
-            private static byte[] ntlmHash(String password) throws Exception {
+            private static byte[] ntlmHash(String password) throws UnsupportedEncodingException {
                 byte[] unicodePassword = password.getBytes("UnicodeLittleUnmarked");
                 MD4Digest md4 = new MD4Digest();
                 md4.update(unicodePassword, 0, unicodePassword.length);
@@ -1081,7 +1078,7 @@ public class HTTP {
              * and LMv2 Responses. 
              */
             private static byte[] ntlmv2Hash(String target, String user,
-                                             String password) throws Exception {
+                                             String password) throws UnsupportedEncodingException {
                 byte[] ntlmHash = ntlmHash(password);
                 String identity = user.toUpperCase() + target.toUpperCase();
                 return hmacMD5(identity.getBytes("UnicodeLittleUnmarked"), ntlmHash);
@@ -1097,7 +1094,7 @@ public class HTTP {
              * hash).
              */
             private static byte[] lmResponse(byte[] hash, byte[] challenge)
-                throws Exception {
+                {
                 /*
                 byte[] keyBytes = new byte[21];
                 System.arraycopy(hash, 0, keyBytes, 0, 16);
@@ -1132,7 +1129,7 @@ public class HTTP {
              * client data).
              */
             private static byte[] lmv2Response(byte[] hash, byte[] clientData,
-                                               byte[] challenge) throws Exception {
+                                               byte[] challenge) {
                 byte[] data = new byte[challenge.length + clientData.length];
                 System.arraycopy(challenge, 0, data, 0, challenge.length);
                 System.arraycopy(clientData, 0, data, challenge.length,
@@ -1210,7 +1207,7 @@ public class HTTP {
              *
              * @return The HMAC-MD5 hash of the given data.
              */
-            private static byte[] hmacMD5(byte[] data, byte[] key) throws Exception {
+            private static byte[] hmacMD5(byte[] data, byte[] key) {
                 byte[] ipad = new byte[64];
                 byte[] opad = new byte[64];
                 for (int i = 0; i < 64; i++) {