aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2001-04-17 07:28:49 +0000
committerDaniel Stenberg <daniel@haxx.se>2001-04-17 07:28:49 +0000
commitfd8ea204c0faec613a43166af578bff95e724f79 (patch)
tree43a1f3d0135b59ebe687fe8614bc26713edc9c8f /lib
parentb86674174a5f04a4330923d33a6f3892d2709705 (diff)
use GMT for the conditional timed gets (reported by Phil Karn)
Diffstat (limited to 'lib')
-rw-r--r--lib/http.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/lib/http.c b/lib/http.c
index a701e2a46..58d03ac65 100644
--- a/lib/http.c
+++ b/lib/http.c
@@ -646,12 +646,21 @@ CURLcode Curl_http(struct connectdata *conn)
if(data->timecondition) {
struct tm *thistime;
+ /* Phil Karn (Fri, 13 Apr 2001) pointed out that the If-Modified-Since
+ * header family should have their times set in GMT as RFC2616 defines:
+ * "All HTTP date/time stamps MUST be represented in Greenwich Mean Time
+ * (GMT), without exception. For the purposes of HTTP, GMT is exactly
+ * equal to UTC (Coordinated Universal Time)." (see page 20 of RFC2616).
+ */
+
#ifdef HAVE_LOCALTIME_R
/* thread-safe version */
+ /* We assume that the presense of localtime_r() proves the presense
+ of gmtime_r() which is a bit ugly but might work */
struct tm keeptime;
- thistime = (struct tm *)localtime_r(&data->timevalue, &keeptime);
+ thistime = (struct tm *)gmtime_r(&data->timevalue, &keeptime);
#else
- thistime = localtime(&data->timevalue);
+ thistime = gmtime(&data->timevalue);
#endif
if(NULL == thistime) {
failf(data, "localtime() failed!");