fixed invalid "304 Not Modified" on broken timestamps

git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@1926 152afb58-edef-0310-8abb-c4023f1b3aa9
svn/tags/lighttpd-1.4.17
Jan Kneschke 16 years ago
parent f0333c8c0d
commit 1920bd2739

@ -279,7 +279,10 @@ 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';
strptime(buf, "%a, %d %b %Y %H:%M:%S GMT", &tm);
if (NULL == strptime(buf, "%a, %d %b %Y %H:%M:%S GMT", &tm)) {
con->http_status = 412;
return HANDLER_FINISHED;
}
t_header = mktime(&tm);
strptime(mtime->ptr, "%a, %d %b %Y %H:%M:%S GMT", &tm);
@ -323,7 +326,14 @@ 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';
strptime(buf, "%a, %d %b %Y %H:%M:%S GMT", &tm);
if (NULL == strptime(buf, "%a, %d %b %Y %H:%M:%S GMT", &tm)) {
/**
* parsing failed, let's get out of here
*/
log_error_write(srv, __FILE__, __LINE__, "ss",
"strptime() failed on", buf);
return HANDLER_GO_ON;
}
t_header = mktime(&tm);
strptime(mtime->ptr, "%a, %d %b %Y %H:%M:%S GMT", &tm);

Loading…
Cancel
Save