httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dietz, Phil E." <PEDi...@West.com>
Subject [RFC] InodeEtag option
Date Mon, 26 Feb 2001 20:44:31 GMT
OK, I converted my ETag patch to use Options.  Of note:

- the allow_options_t size increased to a long because all 8 bits of char
were in use.
- if InodeEtag is not present in Options, it uses inodes like the current
behaviour.
- the patch below is beta and against version 1.3.17.  Newer ones against
1.3.19 to follow.

I will test with Insure later this week.
Phil Dietz

Patch Version 1.0:

--- ../apache_1.3.17/src/main/http_protocol.c   Thu Jan 18 07:25:07 2001
+++ src/main/http_protocol.c    Mon Feb 26 11:56:23 2001
@@ -656,16 +656,30 @@
      * we send a weak tag instead of a strong one, since it could
      * be modified again later in the second, and the validation
      * would be incorrect.
+     *
+     * The use of the inode is controlled with the InodeEtag Option.
+     * Disabling allows browser-side cacheing (304s) to happen more often
+     * when serving default_handler objects from web farms with > 1 unit.
      */
     
     weak = ((r->request_time - r->mtime > 1) && !force_weak) ? "" : "W/";
 
     if (r->finfo.st_mode != 0) {
-        etag = ap_psprintf(r->pool,
+        
+       if (ap_allow_options(r) & OPT_INODE_ETAG) {
+            etag = ap_psprintf(r->pool,
                     "%s\"%lx-%lx-%lx\"", weak,
                     (unsigned long) r->finfo.st_ino,
                     (unsigned long) r->finfo.st_size,
                     (unsigned long) r->mtime);
+       } 
+       else {
+            etag = ap_psprintf(r->pool,
+                    "%s\"%lx-%lx\"", weak,
+                    (unsigned long) r->finfo.st_size,
+                    (unsigned long) r->mtime);
+       }
+
     }
     else {
         etag = ap_psprintf(r->pool, "%s\"%lx\"", weak,


--- ../apache_1.3.17/src/main/http_core.c       Mon Jan 15 12:04:57 2001
+++ src/main/http_core.c        Mon Feb 26 14:28:40 2001
@@ -1298,6 +1298,9 @@
        else if (!strcasecmp(w, "RunScripts")) { /* AI backcompat. Yuck */
            opt = OPT_MULTI|OPT_EXECCGI;
        }
+       else if (!strcasecmp(w, "InodeEtag")) {
+           opt = OPT_INODE_ETAG;
+       }
        else if (!strcasecmp(w, "None")) {
            opt = OPT_NONE;
        }

--- ../apache_1.3.17/src/include/http_core.h    Mon Jan 15 12:04:33 2001
+++ src/include/http_core.h     Mon Feb 26 14:43:18 2001
@@ -84,7 +84,8 @@
 #define OPT_INCNOEXEC 32
 #define OPT_SYM_OWNER 64
 #define OPT_MULTI 128
-#define OPT_ALL (OPT_INDEXES|OPT_INCLUDES|OPT_SYM_LINKS|OPT_EXECCGI)
+#define OPT_INODE_ETAG 256
+#define OPT_ALL
(OPT_INDEXES|OPT_INCLUDES|OPT_SYM_LINKS|OPT_EXECCGI|OPT_INODE_ETAG)
 
 /* options for get_remote_host() */
 /* REMOTE_HOST returns the hostname, or NULL if the hostname
@@ -178,7 +179,7 @@
 
 /* Per-directory configuration */
 
-typedef unsigned char allow_options_t;
+typedef unsigned long allow_options_t;
 typedef unsigned char overrides_t;
 
 typedef struct {


Mime
View raw message