You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by "Dietz, Phil E." <PE...@West.com> on 2001/02/26 21:44:31 UTC

[RFC] InodeEtag option

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 {


FilesystemOption flags???

Posted by "William A. Rowe, Jr." <wr...@rowe-clan.net>.
From: "Dietz, Phil E." <PE...@West.com>
Sent: Monday, February 26, 2001 2:44 PM


> 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.

Here are the _filesystem_ flags that should be introduced, IMHO, as we can;

InodeEtag : base etag values on the inode value (false on OS2 and clusters, 
for example.)  Thank you Phil for raising this.

DirTrackModified : set autoindex and other directory last-modified dates 
based on the mtime (a problem for some since a change to the inode-values won't 
necessarily update the mtime of the directory containing the file for all 
filesystems - but a huge win for preventing unnecessary autoindex generation.)  
Best of both worlds, enable this directive, yet document that the user must 
touch the directory itself (rename a file within it, twice, if that file is 
really updated, or unlink and readd files when they change, or simply create 
a  file and blast it immediately.)  This too is bad for server farms.

IgnoresCase : This <directory > and descendents is mounted case-insensitive
(such as a samba mount point or the entire os2/win32/netware filesystem).
Blowing this directive results in serious security vulnerabilities.

AliasesExist : This <directory > and descendents are on a mount with aliases,
such as Win32/Netware 8.3 filenames.  This can be disabled, even on those
platforms, so the user might choose to toggle this off.  Again, any
misconfiguration will result in security vulnerabilities.

ExactNames : Refuse to serve content in the wrong case or from an alias
(requires IgnoreCase or AliasesExist.)  

AllowSymlink[IfOwnerMatch|IfGroupMatch] : really belongs in this context,
outside of the usual 'options'.  This has everything to do with the filesystem
and it's permissions and structure, more than content itself.

Others (???)

I don't really have time to implement these all at the moment, but I thought
I'd point them out as a 'family' of issues that will ultimately allow Unix
to properly support samba/clusters/etc, and Win32/OS2/Netware to be more
optimized when the admin wants to take the time to carefully construct their
web structure.  [And remind folks that the original patch is still very deserving
of consideration, in the broader scope of 'FilesystemOptions'.]

I personally want to see all of these become seperate from the typical 'Options'.
That helps to create mount-point specific (or '/' root-global) settings for the
filesystem that are independent of Options changes.

Bill


Re: [RFC] InodeEtag option

Posted by "William A. Rowe, Jr." <wr...@rowe-clan.net>.
From: "Rodent of Unusual Size" <Ke...@Golux.Com>
Sent: Monday, February 26, 2001 3:01 PM


> "Dietz, Phil E." wrote:
> > 
> > - the allow_options_t size increased to a long because all 8 bits
> > of char were in use.
> 
> Ouch.  I think that has killed changes to Options in the past.

So do we

1. bite the bullet and increment the mmn?

2. add more_options as a long at the end of the structure, increment
   the mmn, and perhaps some authors get away with ignoring the bump?

Bill


Re: [RFC] InodeEtag option

Posted by Rodent of Unusual Size <Ke...@Golux.Com>.
"Dietz, Phil E." wrote:
> 
> - the allow_options_t size increased to a long because all 8 bits
> of char were in use.

Ouch.  I think that has killed changes to Options in the past.
-- 
#ken    P-)}

Ken Coar                    <http://Golux.Com/coar/>
Apache Software Foundation  <http://www.apache.org/>
"Apache Server for Dummies" <http://Apache-Server.Com/>
"Apache Server Unleashed"   <http://ApacheUnleashed.Com/>

ApacheCon 2001!
Four tracks with over 70+ sessions. Free admission to exhibits
and special events - keynote presentations by John 'maddog' Hall
and David Brin. Special thanks to our Platinum Sponsors IBM and
Covalent, Gold Sponsor Thawte, and Silver Sponsor Compaq.  Attend
only Apache event designed and fully supported by the members of
the ASF. See more information and register at <http://ApacheCon.Com/>!

Re: [RFC] InodeEtag option

Posted by "William A. Rowe, Jr." <li...@rowe-clan.net>.
Folks,

  I thoroughly support this patch (as an Options flag or as a stand-alone
indicator) for 1.3.20.  I'm +1 on (finally) extending the Options byte, but
+1 on the alternative since folks object.

Rodent: Extending Options has been nixed in the past [no opinion]
Joshua: Options is already overloaded, confusing [a -.5, perhaps?]
Marc:   Options is depreciated NCSA compatibility cruft

Phil, I can't find your original patch (sans Options.) I'd suggest the
directive ETagIdentity flag (on or off, default of on for most platforms, 
perhaps an IFDEF for win32/os2 to off.)

Bill

----- Original Message ----- 
From: "Dietz, Phil E." <PE...@West.com>
To: <ne...@apache.org>
Sent: Monday, February 26, 2001 3:44 PM
Subject: [RFC] InodeEtag option


> 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 {
> 
>