diff options
Diffstat (limited to 'lib/http.c')
-rw-r--r-- | lib/http.c | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/lib/http.c b/lib/http.c index 0632f6084..5e3f1b10c 100644 --- a/lib/http.c +++ b/lib/http.c @@ -38,12 +38,6 @@ * ------------------------------------------------------------ ****************************************************************************/ -#ifdef NEED_REENTRANT -#define _REENTRANT /* Necessary to use in Solaris, since the silly guys at Sun - made the localtime_r() prototype dependent on it (or - _POSIX_C_SOURCE or _POSIX_PTHREAD_SEMANTICS). */ -#endif - /* -- WIN32 approved -- */ #include <stdio.h> #include <string.h> @@ -57,6 +51,12 @@ #include "setup.h" +#ifdef NEED_REENTRANT +#define _REENTRANT /* Necessary to use in Solaris, since the silly guys at Sun + made the localtime_r() prototype dependent on it (or + _POSIX_C_SOURCE or _POSIX_PTHREAD_SEMANTICS). */ +#endif + #if defined(WIN32) && !defined(__GNUC__) || defined(__MINGW32__) #include <winsock.h> #include <time.h> @@ -378,7 +378,7 @@ CURLcode http(struct connectdata *conn) #ifdef HAVE_LOCALTIME_R /* thread-safe version */ struct tm keeptime; - thistime = localtime_r(&data->timevalue, &keeptime); + thistime = (struct tm *)localtime_r(&data->timevalue, &keeptime); #else thistime = localtime(&data->timevalue); #endif @@ -492,13 +492,19 @@ CURLcode http(struct connectdata *conn) actually set your own */ sendf(data->firstsocket, data, "Content-Length: %d\r\n", - strlen(data->postfields)); + (data->postfieldsize?data->postfieldsize: + 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 */ + if(data->postfieldsize) { + ssend(data->firstsocket, data, "\r\n", 2); + ssend(data->firstsocket, data, data->postfields, data->postfieldsize); + ssend(data->firstsocket, data, "\r\n", 2); + } sendf(data->firstsocket, data, "\r\n" "%s\r\n", |