2003/10/31 09:50:08
[org.ibex.core.git] / src / org / xwt / HTTP.java
index 2980ed5..7295f1f 100644 (file)
@@ -181,18 +181,8 @@ public class HTTP {
             return;
         } catch (UnknownHostException uhe) { }
 
-        if (Platform.detectProxy() == null) throw new HTTPException("could not resolve hostname \"" + host + "\" and no proxy configured");
-        if (Log.on) Log.log(this, "  could not resolve host " + host + "; using xmlrpc.xwt.org to ensure security");
-        try {
-            JS.Array args = new JS.Array();
-            args.addElement(host);
-            Object ret = new XMLRPC("http://xmlrpc.xwt.org/RPC2/", "dns.resolve").call(args);
-            if (ret == null || !(ret instanceof String)) throw new Exception("    xmlrpc.xwt.org returned non-String: " + ret);
-            resolvedHosts.put(host, ret);
-            return;
-        } catch (Throwable e) {
-            throw new HTTPException("exception while attempting to use xmlrpc.xwt.org to resolve " + host + ": " + e);
-        }
+        if (Platform.detectProxy() == null)
+            throw new HTTPException("could not resolve hostname \"" + host + "\" and no proxy configured");
     }
 
 
@@ -293,9 +283,11 @@ public class HTTP {
             org.xwt.js.JS.Array args = new org.xwt.js.JS.Array();
             args.addElement(url.toString());
             args.addElement(url.getHost());
+            /* FIXME
             Object obj = pacFunc.call(args);
             if (Log.verbose) Log.log(this, "  PAC script returned \"" + obj + "\"");
             pac = obj.toString();
+            */
         } catch (Throwable e) {
             if (Log.on) Log.log(this, "PAC script threw exception " + e);
             return null;
@@ -498,7 +490,7 @@ public class HTTP {
     // HTTPInputStream ///////////////////////////////////////////////////////////////////////////////////
 
     /** An input stream that represents a subset of a longer input stream. Supports HTTP chunking as well */
-    public class HTTPInputStream extends FilterInputStream {
+    public class HTTPInputStream extends FilterInputStream implements KnownLength {
 
         /** if chunking, the number of bytes remaining in this subset; otherwise the remainder of the chunk */
         private int length = 0;
@@ -523,6 +515,7 @@ public class HTTP {
             this.length = length == -1 ? 0 : length;
         }
 
+        public int getLength() { return contentLength; }
         public boolean markSupported() { return false; }
         public int read(byte[] b) throws IOException { return read(b, 0, b.length); }
         public long skip(long n) throws IOException { return read(null, -1, (int)n); }
@@ -788,7 +781,10 @@ public class HTTP {
                 }
 
                 JS.CompiledFunction scr = JS.parse("PAC script at " + url, 0, new StringReader(script));
+                // FIXME
+                /*
                 scr.call(new JS.Array(), proxyAutoConfigRootScope);
+                */
                 return (JS.Callable)proxyAutoConfigRootScope.get("FindProxyForURL");
             } catch (Exception e) {
                 if (Log.on) {
@@ -824,6 +820,8 @@ public class HTTP {
 
                 if (authorization != oldAuth) return;
                 if (Log.on) Log.log(Authorization.class, "displaying proxy authorization dialog");
+                /*
+                  FIXME
                 Message.Q.add(new Message() {
                         public void perform() {
                             Box b = new Box();
@@ -833,7 +831,7 @@ public class HTTP {
                             b.put("proxyIP", proxyIP);
                         }
                     });
-
+                */
                 waitingForUser.block();
                 if (Log.on) Log.log(Authorization.class, "got proxy authorization info; re-attempting connection");