aboutsummaryrefslogtreecommitdiff
path: root/lib/http.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/http.c')
-rw-r--r--lib/http.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/http.c b/lib/http.c
index 711775bbd..c8be1e35d 100644
--- a/lib/http.c
+++ b/lib/http.c
@@ -61,6 +61,7 @@
#endif
#include <netinet/in.h>
#include <sys/time.h>
+
#include <sys/resource.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
@@ -360,7 +361,18 @@ CURLcode http(struct connectdata *conn)
if(data->timecondition) {
struct tm *thistime;
+#ifdef HAVE_LOCALTIME_R
+ extern struct tm *localtime_r(time_t *, struct tm *);
+ /* thread-safe version */
+ struct tm keeptime;
+ thistime = localtime_r(&data->timevalue, &keeptime);
+#else
thistime = localtime(&data->timevalue);
+#endif
+ if(NULL == thistime) {
+ failf(data, "localtime() failed!");
+ return CURLE_OUT_OF_MEMORY;
+ }
#ifdef HAVE_STRFTIME
/* format: "Tue, 15 Nov 1994 12:45:26 GMT" */