Browse Source

Set tm.tm_isdst = 0 before mktime() (fixes #2047)

git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@2608 152afb58-edef-0310-8abb-c4023f1b3aa9
svn/tags/lighttpd-1.4.24
Stefan Bühler 13 years ago
parent
commit
0413cf0ecf
  1. 1
      NEWS
  2. 10
      src/http-header-glue.c

1
NEWS

@ -33,6 +33,7 @@ NEWS
* Allow mod_mysql_vhost to use stored procedures (fixes #2011, thx Ben Brown)
* Fix ipv6 in mod_proxy (fixes #2043)
* Print errors from include_shell to stderr
* Set tm.tm_isdst = 0 before mktime() (fixes #2047)
- 1.4.23 - 2009-06-19
* Added some extra warning options in cmake and fix the resulting warnings (unused/static functions)

10
src/http-header-glue.c

@ -259,7 +259,7 @@ int http_response_handle_cachable(server *srv, connection *con, buffer *mtime) {
}
if (0 == strncmp(con->request.http_if_modified_since, mtime->ptr, used_len)) {
con->http_status = 304;
if ('\0' == mtime->ptr[used_len]) con->http_status = 304;
return HANDLER_FINISHED;
} else {
char buf[sizeof("Sat, 23 Jul 2005 21:20:01 GMT")];
@ -281,15 +281,16 @@ int http_response_handle_cachable(server *srv, connection *con, buffer *mtime) {
strncpy(buf, con->request.http_if_modified_since, used_len);
buf[used_len] = '\0';
tm.tm_isdst = 0;
if (NULL == strptime(buf, "%a, %d %b %Y %H:%M:%S GMT", &tm)) {
con->http_status = 412;
con->mode = DIRECT;
return HANDLER_FINISHED;
}
tm.tm_isdst = 0;
t_header = mktime(&tm);
strptime(mtime->ptr, "%a, %d %b %Y %H:%M:%S GMT", &tm);
tm.tm_isdst = 0;
t_file = mktime(&tm);
if (t_file > t_header) return HANDLER_GO_ON;
@ -318,7 +319,7 @@ int http_response_handle_cachable(server *srv, connection *con, buffer *mtime) {
}
if (0 == strncmp(con->request.http_if_modified_since, mtime->ptr, used_len)) {
con->http_status = 304;
if ('\0' == mtime->ptr[used_len]) con->http_status = 304;
return HANDLER_FINISHED;
} else {
char buf[sizeof("Sat, 23 Jul 2005 21:20:01 GMT")];
@ -331,16 +332,17 @@ int http_response_handle_cachable(server *srv, connection *con, buffer *mtime) {
strncpy(buf, con->request.http_if_modified_since, used_len);
buf[used_len] = '\0';
tm.tm_isdst = 0;
if (NULL == strptime(buf, "%a, %d %b %Y %H:%M:%S GMT", &tm)) {
/**
* parsing failed, let's get out of here
*/
return HANDLER_GO_ON;
}
tm.tm_isdst = 0;
t_header = mktime(&tm);
strptime(mtime->ptr, "%a, %d %b %Y %H:%M:%S GMT", &tm);
tm.tm_isdst = 0;
t_file = mktime(&tm);
if (t_file > t_header) return HANDLER_GO_ON;

Loading…
Cancel
Save