[Patch] HTTP connections

Michael Koch konqueror@gmx.de
Tue Oct 26 11:51:00 GMT 2004


Hi list,


I just commited the attached patch to fix HTTP connections. SUN seems to
implicitely switch to POST method when getOutputStream() is called.

A mauve testcase for this got written an commited.

GNU inetlib seems to have this bug too.


Michael


2004-10-26  Michael Koch  <konqueror@gmx.de>

	* gnu/java/net/protocol/http/Connection.java
	(getOutputStream): Implicitely switch to POST method.

-------------- next part --------------
Index: gnu/java/net/protocol/http/Connection.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/gnu/java/net/protocol/http/Connection.java,v
retrieving revision 1.22
diff -u -r1.22 Connection.java
--- gnu/java/net/protocol/http/Connection.java	22 Oct 2004 21:15:38 -0000	1.22
+++ gnu/java/net/protocol/http/Connection.java	26 Oct 2004 11:47:14 -0000
@@ -391,7 +391,8 @@
   }
 
   /**
-   * Returns on OutputStream for writing to this connection.
+   * Returns on OutputStream for writing to this connection. This method
+   * implicitely changes request method to <code>POST</code>.
    *
    * @return An OutputStream for this connection.
    *
@@ -410,6 +411,9 @@
     if (bufferedOutputStream == null)
       bufferedOutputStream = new ByteArrayOutputStream (256); //default is too small
     
+    // Force POST request method.
+    setRequestMethod("POST");
+
     return bufferedOutputStream;
   }
 


More information about the Java-patches mailing list