You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Andrew Ford <an...@icarus.demon.co.uk> on 1996/11/13 19:35:52 UTC

Alternative syntax for expires directive

Andrew

Looking at mod_expires.c in today's 1.2beta I have a suggestion to
improve the syntax, namely that the words "in", "after" and "aged"
should be accepted for the ExpiresDefault and ExpiresByType
directives.  This makes them read in a more English-like way, i.e.

	ExpiresDefault "in 30 days"      (or ExpiresDefault "after 30 days")

rather than 

	ExpiresDefault "access plus 30 days"


and

	ExpiresDefault "aged 2 weeks"

rather than

	ExpiresDefault "modification plus 2 weeks"



"in" and "after" should be synonyms for "access"; and "aged" a synonym
for "modification".

The only problem is that the code currently really only looks at the
first character of the keyword, but arguably users shouldn't rely on
that behaviour.

Regards
Andrew
-- 
Andrew Ford                             Email:  andrew@icarus.demon.co.uk
Independent Software Consultant         WWW:    http://www.nhbs.co.uk/aford/
"Brittany", Wells Road,                 Tel:    +44 1452 770836  Fax: 770835
Eastcombe, Stroud, GL6 7EE, GB          Mobile: +44 385 258278


*** mod_expires.c.orig	Wed Nov 13 18:26:26 1996
--- mod_expires.c	Wed Nov 13 18:30:16 1996
***************
*** 256,264 ****
       */
      word = getword_conf( pool, &code );
      if ( !strncasecmp( word, "now", 1 ) ||
! 	 !strncasecmp( word, "access", 1 ) ) {
  	base = 'A';
!     } else if ( !strncasecmp( word, "modification", 1 ) ) {
  	base = 'M';
      } else {
  	return pstrcat( pool, "bad expires code, unrecognised <base> '",
--- 256,267 ----
       */
      word = getword_conf( pool, &code );
      if ( !strncasecmp( word, "now", 3 ) ||
!          !strncasecmp( word, "in", 2 ) ||
!          !strncasecmp( word, "after", 5 ) ||
! 	 !strncasecmp( word, "access", 6 ) ) {
  	base = 'A';
!     } else if ( !strncasecmp( word, "modification", 12 ) ||
!                 !strncasecmp( word, "aged", 3 ) ) {
  	base = 'M';
      } else {
  	return pstrcat( pool, "bad expires code, unrecognised <base> '",