httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r...@imdb.com (Rob Hartill)
Subject mod_expires fix
Date Tue, 31 Dec 1996 15:23:54 GMT

mod_expires does its stuff for subrequests... a complete waste of time
and energy me thinks. There are probably other places in mod_expires and
other mod_ules that would benefit from an early DECLINE when they are
wasting their time.




Index: mod_expires.c
===================================================================
RCS file: /export/home/cvs/apache/src/mod_expires.c,v
retrieving revision 1.1
diff -c -r1.1 mod_expires.c
*** mod_expires.c       1996/12/10 05:03:07     1.1
--- mod_expires.c       1996/12/31 15:16:47
***************
*** 390,400 ****
      time_t additional; 
      time_t expires; 
  
      if ( r->finfo.st_mode == 0 )
        return DECLINED;
  
-     /* COMMA bites my ass...
-      */
      if ( conf == NULL ) {
          log_reason ("internal error in expires_module; add_expires(), conf == 
NULL", r->filename, r);
        return SERVER_ERROR;
--- 390,402 ----
      time_t additional; 
      time_t expires; 
  
+     if (r->main != NULL) {
+       return DECLINED;      /* don't add Expires headers for subrequests */
+     }
+ 
      if ( r->finfo.st_mode == 0 )
        return DECLINED;
  
      if ( conf == NULL ) {
          log_reason ("internal error in expires_module; add_expires(), conf == 
NULL", r->filename, r);
        return SERVER_ERROR;



=========================================================================

I've hacked my copy of mod_expires to add "Cache-Control" headers. This is
FYI unless someone thinks it's worth adding.


***************
*** 450,455 ****
--- 452,462 ----
      };
  
      expires = base + additional;
+ {
+ char age[80];
+ sprintf(age, "max-age=%d", (int)expires - (int)time(NULL));
+ table_set( r->headers_out, "Cache-Control", age);
+ }
      tzset();  /* redundant? called implicitly by localtime, at least 
                 * under FreeBSD
                 */





rob

Mime
View raw message