lynx-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

lynx-dev dev.17 patch 1 - FTP times


From: Klaus Weide
Subject: lynx-dev dev.17 patch 1 - FTP times
Date: Mon, 3 Jan 2000 09:46:14 -0600 (CST)

* Date calculations for file times in FTP directory listings used cached
  values for the current day and year that never got reset.  This could
  cause wrong ordering when sorting by date, and possibly other errors,
  especially in long-running lynx sessions.  Now recalculate them for each
  new directory request if they are needed.
* Be slightly more tolerant about FTP directory listing file times that
  appear to lie in the future: allow today plus one day without assuming
  that it must mean a year ago, to account for possible timezone differences.


Index: 2.38/WWW/Library/Implementation/HTFTP.c
--- 2.38/WWW/Library/Implementation/HTFTP.c Mon, 25 Oct 1999 09:01:18 -0500
+++ 2.38(w)/WWW/Library/Implementation/HTFTP.c Sun, 02 Jan 2000 11:25:46 -0600
@@ -1279,7 +1279,6 @@
        day[0] = '0';
     }
     strncpy(month, (char *)ctime(&NowTime)+4, 3);
-    strncpy(month, (char *)ctime(&NowTime)+4, 3);
     month[3] = '\0';
     for (i = 0; i < 12; i++) {
        if (!strcasecomp(month, months[i])) {
@@ -2459,7 +2458,11 @@
                if (date1[6] == ' ' || date1[6] == HT_NON_BREAK_SPACE) {
                    date1[6] = '0';
                }
-               if (date1[0] == '9' && atoi(date1) > TheDate) {
+               /*  If no year given, assume last year if it would otherwise
+                *  be in the future by more than one day.  The one day
+                *  tolerance is to account for a possible timezone
+                *  difference. - kw */
+               if (date1[0] == '9' && atoi(date1) > TheDate + 1) {
                    for (i = 0; i < 4; i++) {
                        date1[i] = LastYear[i];
                    }
@@ -2490,7 +2493,11 @@
                if (date2[6] == ' ' || date2[6] == HT_NON_BREAK_SPACE) {
                    date2[6] = '0';
                }
-               if (date2[0] == '9' && atoi(date2) > TheDate) {
+               /*  If no year given, assume last year if it would otherwise
+                *  be in the future by more than one day.  The one day
+                *  tolerance is to account for a possible timezone
+                *  difference. - kw */
+               if (date2[0] == '9' && atoi(date2) > TheDate + 1) {
                    for (i = 0; i < 4; i++) {
                        date2[i] = LastYear[i];
                    }
@@ -2545,6 +2552,13 @@
 
     _HTProgress (gettext("Receiving FTP directory."));
 
+    /*
+     *  Force the current Date and Year (TheDate, ThisYear, and LastYear)
+     *  to be recalculated for each directory request.  Otherwise we have
+     *  a problem with long-running sessions assuming the wrong date for
+     *  today. - kw
+     */
+    HaveYears = FALSE;
     /*
     ** Check whether we always want the home
     ** directory treated as Welcome. - FM


reply via email to

[Prev in Thread] Current Thread [Next in Thread]