|
|
|
@ -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;
|
|
|
|
|