Patch: Fix HTTP posts

Anthony Green green@redhat.com
Sat Sep 7 12:56:00 GMT 2002


Another little fix from Christophe.  Out HTTP Connection class was trying
to read HTTP headers even for output/POST connections.  This just defers 
reading headers 'til we know for sure that we're going to read from the
socket.

Ok for trunk and 3.2 branch?

AG


2002-09-07  Anthony Green  <green@redhat.com>

	* gnu/gcj/protocol/http/Connection.java: Don't try to read headers
	when this is used as an output stream.  From Christophe Roux.
	(haveHeaders): Define new private boolean.
	(connect): Don't read headers.
	(getInputStream): Read headers.
	
Index: libjava/gnu/gcj/protocol/http/Connection.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/gnu/gcj/protocol/http/Connection.java,v
retrieving revision 1.7
diff -2 -c -p -r1.7 Connection.java
*** libjava/gnu/gcj/protocol/http/Connection.java	23 Aug 2002 04:54:03 -0000	1.7
--- libjava/gnu/gcj/protocol/http/Connection.java	7 Sep 2002 19:52:08 -0000
*************** class Connection extends HttpURLConnecti
*** 40,43 ****
--- 40,44 ----
    private Vector hdrVec = new Vector();
    private BufferedInputStream bufferedIn;
+   private haveHeaders = false;
  
    public Connection(URL url)
*************** class Connection extends HttpURLConnecti
*** 103,108 ****
      out.print("\n");
      out.flush();    
-     getHttpHeaders();
      connected = true;
    }
  
--- 104,109 ----
      out.print("\n");
      out.flush();    
      connected = true;
+     haveHeaders = false;
    }
  
*************** class Connection extends HttpURLConnecti
*** 135,138 ****
--- 136,142 ----
      if (!connected)
        connect();
+ 
+     if (!haveHeaders)
+       getHttpHeaders();
  
      if (!doInput)





More information about the Java-patches mailing list