diff options
author | Daniel Stenberg <daniel@haxx.se> | 2000-08-11 06:39:53 +0000 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2000-08-11 06:39:53 +0000 |
commit | 349a3aaf5b33406445d394922813cf60b5d3264d (patch) | |
tree | 56ab242972c584e1e8fe9a02031d7ac29f3788c9 | |
parent | 8fd44dd6486a834a11625fe87ff1010035d7a424 (diff) |
Made it possible to replace the Content-Type: and Content-Length: headers
curl issues when doing a regular HTTP post. This should not be taken light-
heartedly though. Replacing them might get you into trouble!
-rw-r--r-- | lib/http.c | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/lib/http.c b/lib/http.c index d05e73cf0..fae22816f 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 |