re PR classpath/28661 (HTTP Header differs b/w java and classpath)
authorDavid Daney <ddaney@avtrex.com>
Fri, 22 Sep 2006 18:45:14 +0000 (18:45 +0000)
committerDavid Daney <daney@gcc.gnu.org>
Fri, 22 Sep 2006 18:45:14 +0000 (18:45 +0000)
       PR classpath/28661
       * gnu/java/net/protocol/http/HTTPURLConnection.java (connect):  Add
       default content-type for POST method.

From-SVN: r117149

libjava/classpath/ChangeLog.gcj
libjava/classpath/gnu/java/net/protocol/http/HTTPURLConnection.java

index 19ce9491b0e5785a76d892d4cab0861ec051e90d..98b35cfdbfb56430f38e1e9c33ff8378ca2bd421 100644 (file)
@@ -1,3 +1,9 @@
+2006-09-22  David Daney  <ddaney@avtrex.com>
+
+       PR classpath/28661
+       * gnu/java/net/protocol/http/HTTPURLConnection.java (connect):  Add
+       default content-type for POST method.
+
 2006-09-20  Gary Benson  <gbenson@redhat.com>
 
        * java/net/InetAddress.java: Updated to latest.
index a46d1204b6d811c1345a0da1b7867b3ad96a35ff..cc68a3bac306ca7af3cbc4b788e91c888c1c52f5 100644 (file)
@@ -149,6 +149,14 @@ public class HTTPURLConnection
     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
       {