+2001-04-25 Roger L. Beeman <beeman@cisco.com>
+
+ * http.c (http_atotm): Initialize t.tm_isdst to 0.
+ (mktime_from_utc): Prevent mktime() from having discontinuities at
+ DST transition points.
+
+2001-04-25 Hrvoje Niksic <hniksic@arsdigita.com>
+
+ * html-url.c (get_urls_html): Fix documentation.
+
2001-04-25 Hrvoje Niksic <hniksic@arsdigita.com>
* url.c (UNSAFE_CHAR): Reimplement using a static table.
closure->tail = closure->head = newel;
}
-/* #### Document what this does.
+/* Examine name and attributes of TAG and take appropriate action.
+ What will be done depends on TAG's category and attribute values.
+ Tags of TC_LINK category have attributes that contain links to
+ follow; tags of TC_SPEC category need to be handled specially.
+
#### It would be nice to split this into several functions. */
static void
}
}
-/* Scan FILE, retrieving links to HTML documents from it. Each link is
-
- Similar to get_urls_file, but for HTML files. FILE is scanned as
- an HTML document. get_urls_html() constructs the URLs from the
- relative href-s.
+/* Analyze HTML tags FILE and construct a list of URLs referenced from
+ it. It merges relative links in FILE with THIS_URL. It is aware
+ of <base href=...> and does the right thing.
- If SILENT is non-zero, do not barf on baseless relative links. */
+ If dash_p_leaf_HTML is non-zero, only the elements needed to render
+ FILE ("non-external" links) will be returned. */
urlpos *
get_urls_html (const char *file, const char *this_url, int dash_p_leaf_HTML,
int *meta_disallow_follow)
than local timezone (mktime assumes the latter).
Contributed by Roger Beeman <beeman@cisco.com>, with the help of
- Mark Baushke <mdb@cisco.com> and the rest of the Gurus at CISCO. */
+ Mark Baushke <mdb@cisco.com> and the rest of the Gurus at CISCO.
+ Further improved by Roger with assistance from Edward J. Sabol
+ based on input by Jamie Zawinski. */
+
static time_t
mktime_from_utc (struct tm *t)
{
time_t tl, tb;
+ struct tm *tg;
tl = mktime (t);
if (tl == -1)
- return -1;
- tb = mktime (gmtime (&tl));
- return (tl <= tb ? (tl + (tl - tb)) : (tl - (tb - tl)));
+ {
+ t->tm_hour--;
+ tl = mktime (t);
+ if (tl == -1)
+ return -1; /* can't deal with output from strptime */
+ tl += 3600;
+ }
+ tg = gmtime (&tl);
+ tg->tm_isdst = 0;
+ tb = mktime (tg);
+ if (tb == -1)
+ {
+ tg->tm_hour--;
+ tb = mktime (tg);
+ if (tb == -1)
+ return -1; /* can't deal with output from gmtime */
+ tb += 3600;
+ }
+ return (tl - (tb - tl));
}
/* Check whether the result of strptime() indicates success.
{
struct tm t;
- /* Roger Beeman says: "This function dynamically allocates struct tm
- t, but does no initialization. The only field that actually
- needs initialization is tm_isdst, since the others will be set by
- strptime. Since strptime does not set tm_isdst, it will return
- the data structure with whatever data was in tm_isdst to begin
- with. For those of us in timezones where DST can occur, there
- can be a one hour shift depending on the previous contents of the
- data area where the data structure is allocated." */
- t.tm_isdst = -1;
+ /* According to Roger Beeman, we need to initialize tm_isdst, since
+ strptime won't do it. */
+ t.tm_isdst = 0;
/* Note that under foreign locales Solaris strptime() fails to
recognize English dates, which renders this function useless. I