﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc	uname	nginx_version
93	If-Modified-Since rfc compliance	adrian ilarion ciobanu	somebody	"Shouldn't ''if_modified_since'' be set by default to ''NGX_HTTP_IMS_BEFORE'' to make nginx more RFC compliant? Isn't ''NGX_HTTP_IMS_EXACT'' more like a tweak if one follows rfc guidelines?

Plus, I have this feeling that using _BEFORE by default gives nginx more chances to be bandwidth saviour than by using _EXACT.

''The If-Modified-Since request-header field is used with a method to make it conditional: if the requested variant has not been modified '''since''' the time specified in this field, an entity will not be returned from the server; instead, a 304 (not modified) response will be returned without any message-body.'' (rfc2616)

Then, the '''SHOULD''' specifier we can read at http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.3.5 can be interpreted through _EXACT or _MULTIVERSE logic modifiers.

Nginx default configuration makes the flow a little bit mind-effing, back-to-the-future style. 

The file's server timestamp is Tue, 31 Jan 2012 10:43:58 GMT.
Client sends a request with If-Modified-Since set to Tue, 31 Jan 2012 10:43:59 GMT
Client gets a 200 OK
Client sends a request with If-Modified-Since set to Tue, 31 Jan 2012 10:43:58 GMT.
Client gets a 304 Not Modified.

One expects ""304 Not Modified"" in both usecases. It makes sense. Unless the sysadmin explicitly configured the server to act like this.



HEAD -Se http://localhost/somefile |grep Last-Modified
Last-Modified: Tue, 31 Jan 2012 10:43:58 GMT
HEAD -H 'If-Modified-Since: Tue, 31 Jan 2012 10:43:59 GMT' http://localhost/somefile | head -1
200 OK
HEAD -H 'If-Modified-Since: Tue, 31 Jan 2012 10:43:58 GMT' http://localhost/somefile | head -1
304 Not Modified

If I have a good point, the patch seems trivial

{{{
--- http/ngx_http_core_module.c_orig    2012-01-31 12:45:37.000000000 +0100
+++ http/ngx_http_core_module.c 2012-01-31 12:45:53.000000000 +0100
@@ -3486,7 +3486,7 @@
     ngx_conf_merge_uint_value(conf->satisfy, prev->satisfy,
                               NGX_HTTP_SATISFY_ALL);
     ngx_conf_merge_uint_value(conf->if_modified_since, prev->if_modified_since,
-                              NGX_HTTP_IMS_EXACT);
+                              NGX_HTTP_IMS_BEFORE);
     ngx_conf_merge_uint_value(conf->max_ranges, prev->max_ranges,
                               NGX_MAX_INT32_VALUE);
     ngx_conf_merge_uint_value(conf->client_body_in_file_only,
}}}



Thank you,
"	enhancement	closed	minor	1.2.0	nginx-core	1.1.x	wontfix	If-Modified-Since		Linux localhost 2.6.32-5-686-bigmem #1 SMP Wed Jan 11 13:17:56 UTC 2012 i686 GNU/Linux	"nginx version: nginx/1.1.14
built by gcc 4.4.5 (Debian 4.4.5-8)
configure arguments:
"
