2003/11/16 08:28:09
[org.ibex.core.git] / src / org / xwt / HTTP.java
index 2b42f97..f3ff183 100644 (file)
@@ -188,11 +188,18 @@ public class HTTP {
 
     // Methods to attempt socket creation /////////////////////////////////////////////////////////////////
 
+    private Socket getSocket(String host, int port, boolean ssl, boolean negotiate) throws IOException {
+        Socket ret = ssl ? new TinySSL(host, port, negotiate) : new Socket(java.net.InetAddress.getByName(host), port);
+        ret.setTcpNoDelay(true);
+        return ret;
+    }
+
+
     /** Attempts a direct connection */
     public Socket attemptDirect() {
         try {
             if (Log.verbose) Log.log(this, "attempting to create unproxied socket to " + host + ":" + port + (ssl ? " [ssl]" : ""));
-            return Platform.getSocket(host, port, ssl, true);
+            return getSocket(host, port, ssl, true);
         } catch (IOException e) {
             if (Log.on) Log.log(this, "exception in attemptDirect(): " + e);
             return null;
@@ -204,7 +211,7 @@ public class HTTP {
         try {
             if (Log.verbose) Log.log(this, "attempting to create HTTP proxied socket using proxy " + proxyHost + ":" + proxyPort);
 
-            Socket sock = Platform.getSocket(proxyHost, proxyPort, ssl, false);
+            Socket sock = getSocket(proxyHost, proxyPort, ssl, false);
             if (!ssl) {
                 if (!path.startsWith("http://")) path = "http://" + host + ":" + port + path;
             } else {
@@ -240,7 +247,7 @@ public class HTTP {
                                  " proxied socket using proxy " + proxyHost + ":" + proxyPort);
 
         try {
-            Socket sock = Platform.getSocket(proxyHost, proxyPort, ssl, false);
+            Socket sock = getSocket(proxyHost, proxyPort, ssl, false);
             
             DataOutputStream dos = new DataOutputStream(sock.getOutputStream());
             dos.writeByte(0x04);                         // SOCKSv4(a)