51
52
ngx_http_not_modified_header_filter(ngx_http_request_t *r)
54
ngx_http_core_loc_conf_t *clcf;
56
54
if (r->headers_out.status != NGX_HTTP_OK
58
|| r->headers_in.if_modified_since == NULL
59
56
|| r->headers_out.last_modified_time == -1)
61
58
return ngx_http_next_header_filter(r);
61
if (r->headers_in.if_unmodified_since) {
62
return ngx_http_test_precondition(r);
65
if (r->headers_in.if_modified_since) {
66
return ngx_http_test_not_modified(r);
69
return ngx_http_next_header_filter(r);
74
ngx_http_test_precondition(ngx_http_request_t *r)
78
iums = ngx_http_parse_time(r->headers_in.if_unmodified_since->value.data,
79
r->headers_in.if_unmodified_since->value.len);
81
ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
82
"http iums:%d lm:%d", iums, r->headers_out.last_modified_time);
84
if (iums >= r->headers_out.last_modified_time) {
85
return ngx_http_next_header_filter(r);
88
return ngx_http_filter_finalize_request(r, NULL,
89
NGX_HTTP_PRECONDITION_FAILED);
94
ngx_http_test_not_modified(ngx_http_request_t *r)
97
ngx_http_core_loc_conf_t *clcf;
64
99
clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module);