diff --git a/lib/http.c b/lib/http.c
index d05e73cf079c655d9bab7c85f7fb31d4e58ebf14..fae22816f90b1cb006ad5ed8ac63058c31ffc414 100644
--- a/lib/http.c
+++ b/lib/http.c
@@ -481,12 +481,23 @@ CURLcode http(struct connectdata *conn)
     }
     else {
       if(data->bits.http_post) {
-        /* this is the simple x-www-form-urlencoded style */
+        /* this is the simple POST, using x-www-form-urlencoded style */
+
+        if(!checkheaders(data, "Content-Length:"))
+          /* we allow replacing this header, although it isn't very wise to
+             actually set your own */
+          sendf(data->firstsocket, data,
+                "Content-Length: %d\r\n",
+                strlen(data->postfields));
+
+        if(!checkheaders(data, "Content-Type:"))
+          sendf(data->firstsocket, data,
+                "Content-Type: application/x-www-form-urlencoded\r\n");
+
+        /* and here comes the actual data */
         sendf(data->firstsocket, data,
-              "Content-Length: %d\015\012"
-              "Content-Type: application/x-www-form-urlencoded\r\n\r\n"
+              "\r\n"
               "%s\r\n",
-              strlen(data->postfields),
               data->postfields );
       }
       else