Commit 17ae28e0 authored by Daniel Stenberg's avatar Daniel Stenberg
Browse files

Martin Skinner brought back bug report #1230118 to haunt us once again.

(http://curl.haxx.se/bug/view.cgi?id=1230118) curl_getdate() did not work
properly for all input dates on Windows. It was mostly seen on some TZ time
zones using DST. Luckily, Martin also provided a fix.
parent 3c4f6224
Loading
Loading
Loading
Loading
+5 −0
Original line number Original line Diff line number Diff line
@@ -7,6 +7,11 @@
                                  Changelog
                                  Changelog


Daniel (5 December 2006)
Daniel (5 December 2006)
- Martin Skinner brought back bug report #1230118 to haunt us once again.
  (http://curl.haxx.se/bug/view.cgi?id=1230118) curl_getdate() did not work
  properly for all input dates on Windows. It was mostly seen on some TZ time
  zones using DST. Luckily, Martin also provided a fix.

- Alexey Simak filed bug report #1600447
- Alexey Simak filed bug report #1600447
  (http://curl.haxx.se/bug/view.cgi?id=1600447) in which he noted that active
  (http://curl.haxx.se/bug/view.cgi?id=1600447) in which he noted that active
  FTP connections don't work with the multi interface. The problem is here
  FTP connections don't work with the multi interface. The problem is here
+2 −1
Original line number Original line Diff line number Diff line
@@ -28,6 +28,7 @@ This release includes the following bugfixes:
 o Content-Range: header parsing improved
 o Content-Range: header parsing improved
 o CPU 100% load when HTTP upload connection broke
 o CPU 100% load when HTTP upload connection broke
 o active FTP didn't work with multi interface
 o active FTP didn't work with multi interface
 o curl_getdate() could be off one hour for TZ time zones with DST, on windows


Other curl-related news:
Other curl-related news:


@@ -45,6 +46,6 @@ advice from friends like these:


 James Housley, Olaf Stueben, Yang Tse, Gisle Vanem, Bradford Bruce,
 James Housley, Olaf Stueben, Yang Tse, Gisle Vanem, Bradford Bruce,
 Ciprian Badescu, Dmitriy Sergeyev, Nir Soffer, Venkat Akella, Toon Verwaest,
 Ciprian Badescu, Dmitriy Sergeyev, Nir Soffer, Venkat Akella, Toon Verwaest,
 Matt Witherspoon, Alexey Simak
 Matt Witherspoon, Alexey Simak, Martin Skinner


        Thanks! (and sorry if I forgot to mention someone)
        Thanks! (and sorry if I forgot to mention someone)
+12 −15
Original line number Original line Diff line number Diff line
@@ -239,18 +239,6 @@ static time_t Curl_parsedate(const char *date)
  const char *indate = date; /* save the original pointer */
  const char *indate = date; /* save the original pointer */
  int part = 0; /* max 6 parts */
  int part = 0; /* max 6 parts */


#ifdef WIN32
  /*
   * On Windows, we need an odd work-around for the case when no TZ variable
   * is set. If it isn't set and "automatic DST adjustment" is enabled, the
   * time functions below will return values one hour off! As reported and
   * investigated in bug report #1230118.
  */
  const char *env = getenv("TZ");
  if(!env)
    putenv("TZ=GMT");
#endif

  while(*date && (part < 6)) {
  while(*date && (part < 6)) {
    bool found=FALSE;
    bool found=FALSE;


@@ -400,13 +388,22 @@ static time_t Curl_parsedate(const char *date)
    /* thread-safe version */
    /* thread-safe version */
    struct tm keeptime2;
    struct tm keeptime2;
    gmt = (struct tm *)gmtime_r(&t, &keeptime2);
    gmt = (struct tm *)gmtime_r(&t, &keeptime2);
    if(!gmt)
      return -1; /* illegal date/time */
    t2 = mktime(gmt);
#else
#else
    /* It seems that at least the MSVC version of mktime() doesn't work
       properly if it gets the 'gmt' pointer passed in (which is a pointer
       returned from gmtime() pointing to static memory), so instead we copy
       the tm struct to a local struct and pass a pointer to that struct as
       input to mktime(). */
    struct tm gmt2;
    gmt = gmtime(&t); /* use gmtime_r() if available */
    gmt = gmtime(&t); /* use gmtime_r() if available */
#endif
    if(!gmt)
    if(!gmt)
      return -1; /* illegal date/time */
      return -1; /* illegal date/time */

    gmt2 = *gmt;
    t2 = mktime(gmt);
    t2 = mktime(&gmt2);
#endif


    /* Add the time zone diff (between the given timezone and GMT) and the
    /* Add the time zone diff (between the given timezone and GMT) and the
       diff between the local time zone and GMT. */
       diff between the local time zone and GMT. */