Revision: 3110
          http://vexi.svn.sourceforge.net/vexi/?rev=3110&view=rev
Author:   mkpg2
Date:     2008-09-24 16:28:58 +0000 (Wed, 24 Sep 2008)

Log Message:
-----------
Eliminating compiler warnings.

Modified Paths:
--------------
    trunk/core/org.ibex.net/src/org/ibex/net/HTTP.jpp

Modified: trunk/core/org.ibex.net/src/org/ibex/net/HTTP.jpp
===================================================================
--- trunk/core/org.ibex.net/src/org/ibex/net/HTTP.jpp   2008-09-24 16:04:04 UTC 
(rev 3109)
+++ trunk/core/org.ibex.net/src/org/ibex/net/HTTP.jpp   2008-09-24 16:28:58 UTC 
(rev 3110)
@@ -289,121 +289,7 @@
         }
     }
 
-    /** Attempts to use an HTTP proxy, employing the CONNECT method if HTTPS 
is requested */
-    private Socket attemptHttpProxy(String proxyHost, int proxyPort) {
-        try {
-            if (Log.verbose) Log.info(this, "attempting to create HTTP proxied 
socket using proxy " + proxyHost + ":" + proxyPort);
-            Socket sock = getSocket(proxyHost, proxyPort, ssl, false);
 
-            if (!ssl) {
-                if (!path.startsWith("http://";)) path = "http://"; + host + ":" 
+ port + path;
-                return sock;
-            }
-
-            PrintWriter pw = new PrintWriter(new 
OutputStreamWriter(sock.getOutputStream()));
-            BufferedReader br = new BufferedReader(new 
InputStreamReader(sock.getInputStream()));
-            pw.print("CONNECT " + host + ":" + port + " HTTP/1.1\r\n\r\n");
-            pw.flush();
-            String s = br.readLine();
-            if (s.charAt(9) != '2') throw new HTTPException("proxy refused 
CONNECT method: \"" + s + "\"");
-            while (br.readLine().length() > 0) { };
-            ((SSL)sock).negotiate();
-            return sock;
-
-        } catch (IOException e) {
-            Log.info(this, "exception in attemptHttpProxy(): " + e);
-            return null;
-        }
-    }
-
-    /**
-     *  Implements SOCKSv4 with v4a DNS extension
-     *  @see http://www.socks.nec.com/protocol/socks4.protocol
-     *  @see http://www.socks.nec.com/protocol/socks4a.protocol
-     */
-    private Socket attemptSocksProxy(String proxyHost, int proxyPort) {
-
-        // even if host is already a "x.y.z.w" string, we use this to parse it 
into bytes
-        InetAddress addr = null;
-        try { addr = InetAddress.getByName(host); } catch (Exception e) { }
-
-        if (Log.verbose) Log.info(this, "attempting to create SOCKSv4" + (addr 
== null ? "" : "a") +
-                                 " proxied socket using proxy " + proxyHost + 
":" + proxyPort);
-
-        try {
-            Socket sock = getSocket(proxyHost, proxyPort, ssl, false);
-            
-            DataOutputStream dos = new 
DataOutputStream(sock.getOutputStream());
-            dos.writeByte(0x04);                         // SOCKSv4(a)
-            dos.writeByte(0x01);                         // CONNECT
-            dos.writeShort(port & 0xffff);               // port
-            if (addr == null) dos.writeInt(0x00000001);  // bogus IP
-            else dos.write(addr.getAddress());           // actual IP
-            dos.writeByte(0x00);                         // no userid
-            if (addr == null) {
-                PrintWriter pw = new PrintWriter(new OutputStreamWriter(dos));
-                pw.print(host);
-                pw.flush();
-                dos.writeByte(0x00);                     // hostname null 
terminator
-            }
-            dos.flush();
-
-            DataInputStream dis = new DataInputStream(sock.getInputStream());
-            dis.readByte();                              // reply version
-            byte success = dis.readByte();               // success/fail
-            dis.skip(6);                                 // ip/port
-            
-            if ((int)(success & 0xff) == 90) {
-                if (ssl) ((SSL)sock).negotiate();
-                return sock;
-            }
-            Log.info(this, "SOCKS server denied access, code " + (success & 
0xff));
-            return null;
-
-        } catch (IOException e) {
-            Log.info(this, "exception in attemptSocksProxy(): " + e);
-            return null;
-        }
-    }
-
-    /** executes the PAC script and dispatches a call to one of the other 
attempt methods based on the result */
-    /*
-    private Socket attemptPAC(org.ibex.js.JS pacFunc) {
-        if (Log.verbose) Log.info(this, "evaluating PAC script");
-        String pac = null;
-        try {
-            Object obj = pacFunc.call(url, host, null, null, 2);
-            if (Log.verbose) Log.info(this, "  PAC script returned \"" + obj + 
"\"");
-            pac = obj.toString();
-        } catch (Throwable e) {
-            if (Log.on) Log.info(this, "PAC script threw exception " + e);
-            return null;
-        }
-
-        StringTokenizer st = new StringTokenizer(pac, ";", false);
-        while (st.hasMoreTokens()) {
-            String token = st.nextToken().trim();
-            if (Log.verbose) Log.info(this, "  trying \"" + token + "\"...");
-            try {
-                Socket ret = null;
-                if (token.startsWith("DIRECT"))
-                    ret = attemptDirect();
-                else if (token.startsWith("PROXY"))
-                    ret = attemptHttpProxy(token.substring(token.indexOf(' ') 
+ 1, token.indexOf(':')),
-                                           
Integer.parseInt(token.substring(token.indexOf(':') + 1)));
-                else if (token.startsWith("SOCKS"))
-                    ret = attemptSocksProxy(token.substring(token.indexOf(' ') 
+ 1, token.indexOf(':')),
-                                            
Integer.parseInt(token.substring(token.indexOf(':') + 1)));
-                if (ret != null) return ret;
-            } catch (Throwable e) {
-                if (Log.on) Log.info(this, "attempt at \"" + token + "\" 
failed due to " + e + "; trying next token");
-            }
-        }
-        if (Log.on) Log.info(this, "all PAC results exhausted");
-        return null;
-    }
-    */
-
     // Everything Else 
////////////////////////////////////////////////////////////////////////////
 
     private synchronized void connect() throws IOException {
@@ -531,7 +417,7 @@
         if (Log.sLevel >= Log.INFO) Log.info(this, "Proxy AuthChallenge: " + 
h0.get("proxy-authenticate"));
         Hashtable h = 
parseAuthenticationChallenge(h0.get("proxy-authenticate").toString());
         String style = h.get("AUTHTYPE").toString();
-        String realm = (String)h.get("realm");
+        //String realm = (String)h.get("realm");
 
         if (style.equals("NTLM") && Proxy.Authorization.authorization2 == 
null) {
             Log.info(this, "Proxy identified itself as NTLM, sending Type 1 
packet");
@@ -1411,7 +1297,7 @@
              *
              * @param bytes The data whose parity bits are to be adjusted for
              * odd parity.
-             */
+             *//*
             private static void oddParity(byte[] bytes) {
                 for (int i = 0; i < bytes.length; i++) {
                     byte b = bytes[i];
@@ -1424,8 +1310,128 @@
                         bytes[i] &= (byte) 0xfe;
                     }
                 }
-            }
+            }*/
 
         }
     }
 }
+
+/////////////
+// GRAVEYARD
+///////////
+
+///** Attempts to use an HTTP proxy, employing the CONNECT method if HTTPS is 
requested */
+//private Socket attemptHttpProxy(String proxyHost, int proxyPort) {
+//  try {
+//      if (Log.verbose) Log.info(this, "attempting to create HTTP proxied 
socket using proxy " + proxyHost + ":" + proxyPort);
+//      Socket sock = getSocket(proxyHost, proxyPort, ssl, false);
+//
+//      if (!ssl) {
+//          if (!path.startsWith("http://";)) path = "http://"; + host + ":" + 
port + path;
+//          return sock;
+//      }
+//
+//      PrintWriter pw = new PrintWriter(new 
OutputStreamWriter(sock.getOutputStream()));
+//      BufferedReader br = new BufferedReader(new 
InputStreamReader(sock.getInputStream()));
+//      pw.print("CONNECT " + host + ":" + port + " HTTP/1.1\r\n\r\n");
+//      pw.flush();
+//      String s = br.readLine();
+//      if (s.charAt(9) != '2') throw new HTTPException("proxy refused CONNECT 
method: \"" + s + "\"");
+//      while (br.readLine().length() > 0) { };
+//      ((SSL)sock).negotiate();
+//      return sock;
+//
+//  } catch (IOException e) {
+//      Log.info(this, "exception in attemptHttpProxy(): " + e);
+//      return null;
+//  }
+//}
+//
+///**
+//*  Implements SOCKSv4 with v4a DNS extension
+//*  @see http://www.socks.nec.com/protocol/socks4.protocol
+//*  @see http://www.socks.nec.com/protocol/socks4a.protocol
+//*/
+//private Socket attemptSocksProxy(String proxyHost, int proxyPort) {
+//
+//  // even if host is already a "x.y.z.w" string, we use this to parse it 
into bytes
+//  InetAddress addr = null;
+//  try { addr = InetAddress.getByName(host); } catch (Exception e) { }
+//
+//  if (Log.verbose) Log.info(this, "attempting to create SOCKSv4" + (addr == 
null ? "" : "a") +
+//                           " proxied socket using proxy " + proxyHost + ":" 
+ proxyPort);
+//
+//  try {
+//      Socket sock = getSocket(proxyHost, proxyPort, ssl, false);
+//      
+//      DataOutputStream dos = new DataOutputStream(sock.getOutputStream());
+//      dos.writeByte(0x04);                         // SOCKSv4(a)
+//      dos.writeByte(0x01);                         // CONNECT
+//      dos.writeShort(port & 0xffff);               // port
+//      if (addr == null) dos.writeInt(0x00000001);  // bogus IP
+//      else dos.write(addr.getAddress());           // actual IP
+//      dos.writeByte(0x00);                         // no userid
+//      if (addr == null) {
+//          PrintWriter pw = new PrintWriter(new OutputStreamWriter(dos));
+//          pw.print(host);
+//          pw.flush();
+//          dos.writeByte(0x00);                     // hostname null 
terminator
+//      }
+//      dos.flush();
+//
+//      DataInputStream dis = new DataInputStream(sock.getInputStream());
+//      dis.readByte();                              // reply version
+//      byte success = dis.readByte();               // success/fail
+//      dis.skip(6);                                 // ip/port
+//      
+//      if ((int)(success & 0xff) == 90) {
+//          if (ssl) ((SSL)sock).negotiate();
+//          return sock;
+//      }
+//      Log.info(this, "SOCKS server denied access, code " + (success & 0xff));
+//      return null;
+//
+//  } catch (IOException e) {
+//      Log.info(this, "exception in attemptSocksProxy(): " + e);
+//      return null;
+//  }
+//}
+
+/** executes the PAC script and dispatches a call to one of the other attempt 
methods based on the result */
+/*
+private Socket attemptPAC(org.ibex.js.JS pacFunc) {
+  if (Log.verbose) Log.info(this, "evaluating PAC script");
+  String pac = null;
+  try {
+      Object obj = pacFunc.call(url, host, null, null, 2);
+      if (Log.verbose) Log.info(this, "  PAC script returned \"" + obj + "\"");
+      pac = obj.toString();
+  } catch (Throwable e) {
+      if (Log.on) Log.info(this, "PAC script threw exception " + e);
+      return null;
+  }
+
+  StringTokenizer st = new StringTokenizer(pac, ";", false);
+  while (st.hasMoreTokens()) {
+      String token = st.nextToken().trim();
+      if (Log.verbose) Log.info(this, "  trying \"" + token + "\"...");
+      try {
+          Socket ret = null;
+          if (token.startsWith("DIRECT"))
+              ret = attemptDirect();
+          else if (token.startsWith("PROXY"))
+              ret = attemptHttpProxy(token.substring(token.indexOf(' ') + 1, 
token.indexOf(':')),
+                                     
Integer.parseInt(token.substring(token.indexOf(':') + 1)));
+          else if (token.startsWith("SOCKS"))
+              ret = attemptSocksProxy(token.substring(token.indexOf(' ') + 1, 
token.indexOf(':')),
+                                      
Integer.parseInt(token.substring(token.indexOf(':') + 1)));
+          if (ret != null) return ret;
+      } catch (Throwable e) {
+          if (Log.on) Log.info(this, "attempt at \"" + token + "\" failed due 
to " + e + "; trying next token");
+      }
+  }
+  if (Log.on) Log.info(this, "all PAC results exhausted");
+  return null;
+}
+*/
+


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Vexi-svn mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/vexi-svn

Reply via email to