Opened 12 years ago

Closed 12 years ago

#310 closed defect (invalid)

FastCGI cache doesn't handle single-digit days correctly

Reported by: Daniel Lo Nigro Owned by:
Priority: minor Milestone:
Component: nginx-core Version: 1.2.x
Keywords: fastcgi, cache, caching Cc:
uname -a: Linux lisa.youareaninja.com 3.0.14-vs2.3.2.1-beng #1 SMP Thu Dec 29 08:33:19 GMT 2011 i686 GNU/Linux
nginx -V: nginx version: nginx/1.2.7
TLS SNI support enabled
configure arguments: --prefix=/usr/share/nginx --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-client-body-temp-path=/var/lib/nginx/body --http-fastcgi-temp-path=/var/lib/nginx/fastcgi --http-log-path=/var/log/nginx/access.log --http-proxy-temp-path=/var/lib/nginx/proxy --http-scgi-temp-path=/var/lib/nginx/scgi --http-uwsgi-temp-path=/var/lib/nginx/uwsgi --lock-path=/var/lock/nginx.lock --pid-path=/var/run/nginx.pid --with-pcre-jit --with-debug --with-file-aio --with-http_addition_module --with-http_dav_module --with-http_geoip_module --with-http_gzip_static_module --with-http_image_filter_module --with-http_realip_module --with-http_secure_link_module --with-http_stub_status_module --with-http_ssl_module --with-http_sub_module --with-http_xslt_module --with-ipv6 --with-sha1=/usr/include/openssl --with-md5=/usr/include/openssl --with-mail --with-mail_ssl_module --add-module=/usr/src/nginx/source/nginx-1.2.7/debian/modules/nginx-auth-pam --add-module=/usr/src/nginx/source/nginx-1.2.7/debian/modules/nginx-dav-ext-module --add-module=/usr/src/nginx/source/nginx-1.2.7/debian/modules/nginx-echo --add-module=/usr/src/nginx/source/nginx-1.2.7/debian/modules/nginx-upstream-fair --add-module=/usr/src/nginx/source/nginx-1.2.7/debian/modules/nginx-syslog --add-module=/usr/src/nginx/source/nginx-1.2.7/debian/modules/nginx-cache-purge --add-module=/usr/src/nginx/source/nginx-1.2.7/debian/modules/ngx_http_pinba_module --add-module=/usr/src/nginx/source/nginx-1.2.7/debian/modules/ngx_http_substitutions_filter_module

Description

If the Expires header on a FastCGI response has a single digit for the day, Nginx does not cache it. RFC 1123 and RFC 822 say that both one- and two-digit numbers are valid, so this is a bug in Nginx's caching

To replicate, a simple script like this PHP script can be used:

<?php
header('Expires: Sun, 3 Mar 2014 13:22:27 GMT');
header('Last-Modified: Sun, 3 Mar 2013 12:22:27 GMT');
header('Cache-Control: public, max-age=3600');
?>
Hello World

RFC reference: http://www.w3.org/Protocols/rfc822/#z28

Change History (1)

comment:1 by Maxim Dounin, 12 years ago

Resolution: invalid
Status: newclosed

HTTP only allows fixed-width subset of RFC 1123, see http://tools.ietf.org/html/rfc2616#section-3.3.1.

Note: See TracTickets for help on using tickets.