[Privoxy-devel] more time questions
Lee
ler762 at gmail.com
Wed May 4 15:10:30 UTC 2016
On 5/3/16, Fabian Keil <fk at fabiankeil.de> wrote:
> Lee <ler762 at gmail.com> wrote:
>
>> Right now I'm feeling like I can't read code :( What's the expected
>> behavior if --enable-strptime-sanity-checks is configured & this bit
>> is added to regression-tests.action after
>> {+hide-if-modified-since{-60} -crunch-if-none-match}
>> # Set Header = If-Modified-Since: Gee, this date is invalid
>> # Expect Header = REMOVAL
>>
>> # Set Header = If-Modified-Since: Monday, 01-Jan-2025 00:15:00 GMT
>> # Expect Header = SOME CHANGE
>> # Set Header = If-Modified-Since: wednesday, 01-Jan-2025 00:15:00 GMT
>> # Expect Header = SOME CHANGE
>>
>> 1/1/2025 can't be both Mon & Wed so shouldn't one of them cause a
>> complaint?
>
> The strptime() sanity check merely confirms that parsing a date format
> generated from a time_t results in the same time_t again.
>
> This happens after the original date has been parsed. If strptime()
> silently ignores incorrect weekdays the expected behaviour is therefore
> that the check does not detect this.
OK. Not a whole lot of error checking going on, so that explains
that. Thank you.
Next set of questions is
- does timegm in miscutil.c leak memory on non-windows systems?
old_zone = malloc(3 + strlen(zone) + 1);
...
#ifdef _WIN32
free(old_zone);
#endif /* def _WIN32 */
Seems like the code should be doing a free regardless of _WIN32 being
defined or not.
- is there a timing window in miscutil.c timegm that can change TZ to "UTC"?
Unless each thread get it's own copy of environment variables, it
seems like one thread can do
zone = getenv("TZ");
putenv("TZ=UTC");
tzset();
another thread comes along and does
zone = getenv("TZ");
which gets the current TZ=UTC
the first thread finishes up with
putenv(old_zone);
tzset();
and then the other thread does the putenv / tzset and TZ is
permanently changed to UTC.
Thanks,
Lee
More information about the Privoxy-devel
mailing list