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 Wilson <an...@aaaaaaaa.demon.co.uk> on 1996/06/20 16:49:02 UTC
mod_cern_meta.c - MetaFiles
Hi,
here'a quick fix to mod_cern_meta.c which adds a new directive
MetaFiles <on|off>
which can appear in .conf or in .htaccess files. Prior to this
fix the module would attempt to stat .meta files unnecessarily.
With the new directive in a .htaccess file you can limit the module's
operation to specific directories and subdirectories.
The default value for this directive is 'off'.
Note that existing users of mod_cern_meta will need to add the
directive:
MetaFiles on
to their srm.conf or top-level .htaccess to recover the module's
previous (though essentially broken) behaviour.
Thanks to rst for essential provocation.
Ay.
--- cut here ---
*** mod_cern_meta.c.dist Thu Jun 20 14:59:01 1996
--- mod_cern_meta.c Thu Jun 20 15:33:56 1996
***************
*** 52,58 ****
/*
* mod_cern_meta.c
! * version 0.0.5
* status beta
*
* Andrew Wilson <An...@cm.cf.ac.uk> 25.Jan.96
--- 52,58 ----
/*
* mod_cern_meta.c
! * version 0.0.6
* status beta
*
* Andrew Wilson <An...@cm.cf.ac.uk> 25.Jan.96
***************
*** 70,75 ****
--- 70,83 ----
* The module obeys the following directives, which can only appear
* in the server's .conf files and not in any .htaccess file.
*
+ * MetaFiles <on|off>
+ *
+ * turns on|off meta file processing for any directory.
+ * Default value is off
+ *
+ * # turn on MetaFiles in this directory
+ * MetaFiles on
+ *
* MetaDir <directory name>
*
* specifies the name of the directory in which Apache can find
***************
*** 122,128 ****
* need to report missing ones as spurious errors.
* 31.Jan.96 log_error reports about a malformed .meta file, rather
* than a script error.
! *
*/
#include "httpd.h"
--- 130,138 ----
* need to report missing ones as spurious errors.
* 31.Jan.96 log_error reports about a malformed .meta file, rather
* than a script error.
! * 20.Jul.96 MetaFiles <on|off> default off, added, so that module
! * can be configured per-directory. Prior to this the module
! * was running for each request anywhere on the server, naughty..
*/
#include "httpd.h"
***************
*** 132,145 ****
--- 142,159 ----
#include "util_script.h"
#include "http_log.h"
+ #define DIR_CMD_PERMS OR_INDEXES
+
#define DEFAULT_METADIR ".web"
#define DEFAULT_METASUFFIX ".meta"
+ #define DEFAULT_METAFILES 0
module cern_meta_module;
typedef struct {
char *metadir;
char *metasuffix;
+ char *metafiles;
} cern_meta_config;
void *create_cern_meta_config (pool *p, server_rec *dummy)
***************
*** 149,154 ****
--- 163,169 ----
new->metadir = DEFAULT_METADIR;
new->metasuffix = DEFAULT_METASUFFIX;
+ new->metafiles = DEFAULT_METAFILES;
return new;
}
***************
*** 173,179 ****
--- 188,206 ----
return NULL;
}
+ char *set_metafiles (cmd_parms *parms, void *dummy, char *arg)
+ {
+ cern_meta_config *cmc ;
+
+ cmc = get_module_config (parms->server->module_config,
+ &cern_meta_module);
+ cmc->metafiles = arg;
+ return NULL;
+ }
+
+
command_rec cern_meta_cmds[] = {
+ { "MetaFiles", set_metafiles, NULL, DIR_CMD_PERMS, FLAG, NULL},
{ "MetaDir", set_metadir, NULL, RSRC_CONF, TAKE1,
"the name of the directory containing meta files"},
{ "MetaSuffix", set_metasuffix, NULL, RSRC_CONF, TAKE1,
***************
*** 245,250 ****
--- 272,281 ----
cmc = get_module_config (r->server->module_config,
&cern_meta_module);
+
+ if (!cmc->metafiles) {
+ return DECLINED;
+ };
/* if ./.web/$1.meta exists then output 'asis' */
default modules in stock Configuration.
Posted by Brian Behlendorf <br...@organic.com>.
On Thu, 20 Jun 1996, Alexei Kosut wrote:
> On a related note, I'd like to see mod_env and mod_cern_meta (with this
> patch) go back into the default bunch of Apache modules (along with asis,
> imap and actions). I'm not really sure why they got seperated and put in
> the optional section in the 1.1b3/b4 Configuration file, but I'd like them
> back in for the next release. Correct me if I'm wrong, but with the
> MetaFiles directive, neither of them should affect anything unless they're
> given directives, yes?
Well, that wasn't true before the recent patch, but furthermore, they do
affect runtime size and speed. Perhaps for a given module not
perceptibly, but it makes sense to me at least that people should know
what functionality they are putting in the server explicitly... now, for
the binary distributions I might support a much more liberal approach.
My proposed Configuration changes were posted at least a week before I
committed them, and I incorporate commens I had received...
Brian
--=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--
brian@organic.com www.apache.org hyperreal.com http://www.organic.com/JOBS
Re: mod_cern_meta.c - MetaFiles
Posted by Alexei Kosut <ak...@organic.com>.
On Thu, 20 Jun 1996, Andrew Wilson wrote:
> Hi,
> here'a quick fix to mod_cern_meta.c which adds a new directive
>
> MetaFiles <on|off>
+1 for inclusion in the next release, though you might want to use int
instead of char*. They amount to about the same thing, but the rest of the
code uses int for booleans, you might want to as well.
On a related note, I'd like to see mod_env and mod_cern_meta (with this
patch) go back into the default bunch of Apache modules (along with asis,
imap and actions). I'm not really sure why they got seperated and put in
the optional section in the 1.1b3/b4 Configuration file, but I'd like them
back in for the next release. Correct me if I'm wrong, but with the
MetaFiles directive, neither of them should affect anything unless they're
given directives, yes?
-- Alexei Kosut <ak...@organic.com> The Apache HTTP Server
http://www.nueva.pvt.k12.ca.us/~akosut/ http://www.apache.org/