/[classpath]/classpath/gnu/java/net/protocol/http/Connection.java
ViewVC logotype

Diff of /classpath/gnu/java/net/protocol/http/Connection.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.5 by mkoch, Thu Nov 27 11:46:14 2003 UTC revision 1.6 by mkoch, Tue Dec 2 09:28:22 2003 UTC
# Line 75  public final class Connection extends Ht Line 75  public final class Connection extends Ht
75     * The socket we are connected to     * The socket we are connected to
76     */     */
77    private Socket socket;    private Socket socket;
     
   private static String proxyHost = null;  
78    private static int proxyPort = 80;    private static int proxyPort = 80;
79    private static boolean proxyInUse = false;    private static boolean proxyInUse = false;
80      private static String proxyHost = null;
81    
82    static    static
83    {    {
84      // Recognize some networking properties listed at      // Recognize some networking properties listed at
85      // http://java.sun.com/j2se/1.4/docs/guide/net/properties.html.      // http://java.sun.com/j2se/1.4/docs/guide/net/properties.html.
86      String port = null;      String port = null;
87      proxyHost = System.getProperty ("http.proxyHost");      proxyHost = System.getProperty("http.proxyHost");
       
88      if (proxyHost != null)      if (proxyHost != null)
89        {        {
90          proxyInUse = true;          proxyInUse = true;
91                    if ((port = System.getProperty("http.proxyPort")) != null)
         if ((port = System.getProperty ("http.proxyPort")) != null)  
92            {            {
93              try              try
94                {                {
95                  proxyPort = Integer.parseInt (port);                  proxyPort = Integer.parseInt(port);
96                }                }
97              catch (Throwable t)              catch (Throwable t)
98                {                {
# Line 134  public final class Connection extends Ht Line 131  public final class Connection extends Ht
131    /**    /**
132     * Calls superclass constructor to initialize     * Calls superclass constructor to initialize
133     */     */
134    protected Connection (URL url)    protected Connection(URL url)
135    {    {
136      super (url);      super(url);
137    
138      /* Set up some variables */      /* Set up some variables */
139      doOutput = false;      doOutput = false;
# Line 154  public final class Connection extends Ht Line 151  public final class Connection extends Ht
151    
152      // Get address and port number.      // Get address and port number.
153      int port;      int port;
       
154      if (proxyInUse)      if (proxyInUse)
155        {        {
156          port = proxyPort;          port = proxyPort;
157          socket = new Socket (proxyHost, port);          socket = new Socket(proxyHost, port);
158        }        }
159      else      else
160        {        {
161          if ((port = url.getPort()) == -1)          if ((port = url.getPort()) == -1)
162            port = 80;            port = 80;
   
163          // Open socket and output stream.          // Open socket and output stream.
164          socket = new Socket (url.getHost(), port);          socket = new Socket(url.getHost(), port);
165        }        }
166    
167      if (doInput)      if (doInput)
# Line 198  public final class Connection extends Ht Line 193  public final class Connection extends Ht
193            {            {
194              // Ignore errors in closing socket.              // Ignore errors in closing socket.
195            }            }
           
196          socket = null;          socket = null;
197        }        }
198    }    }
# Line 449  public final class Connection extends Ht Line 443  public final class Connection extends Ht
443      return bufferedOutputStream;      return bufferedOutputStream;
444    }    }
445    
 } // class Connection  
446    
447    }

Legend:
Removed from v.1.5  
changed lines
  Added in v.1.6

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26