This is the mail archive of the java-patches@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Patch: Backport PR classpath/28661 fix (more HTTP fixes).


I would like to back port the PR classpath/28661 to libgcj.


Tested on i686-pc-linux-gnu with no regressions.


OK to commit?


2006-09-20 David Daney <ddaney@avtrex.com>


    PR classpath/28661
    * gnu/java/net/protocol/http/HTTPURLConnection.java (connect):  Add
    default content-type for POST method.


Index: gnu/java/net/protocol/http/HTTPURLConnection.java
===================================================================
--- gnu/java/net/protocol/http/HTTPURLConnection.java	(revision 117058)
+++ gnu/java/net/protocol/http/HTTPURLConnection.java	(working copy)
@@ -149,6 +149,14 @@
     final Credentials creds = (username == null) ? null :
       new Credentials (username, password);
     
+    if ("POST".equals(method))
+      {
+        String contentType = requestHeaders.getValue("Content-Type");
+        if (null == contentType)
+          requestHeaders.addValue("Content-Type",
+                                  "application/x-www-form-urlencoded");
+      }
+
     boolean retry;
     do
       {

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]