You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by Brian Behlendorf <br...@hyperreal.org> on 1997/09/18 20:49:44 UTC
cvs commit: apachen/src/modules/standard mod_dld.c mod_include.c mod_mime.c
brian 97/09/18 11:49:42
Modified: src INDENT
src/modules/standard mod_dld.c mod_include.c mod_mime.c
Log:
conformance to apache style a la .indent.pro.
Revision Changes Path
1.33 +4 -4 apachen/src/INDENT
Index: INDENT
===================================================================
RCS file: /export/home/cvs/apachen/src/INDENT,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -r1.32 -r1.33
--- INDENT 1997/09/18 18:40:45 1.32
+++ INDENT 1997/09/18 18:49:32 1.33
@@ -70,18 +70,18 @@
mod_cgi.c DONE by Dean
mod_digest.c DONE by Dean
mod_dir.c DONE by Brian
- mod_dld.c RESERVED by Brian
+ mod_dld.c DONE by Brian
mod_env.c DONE by Brian
mod_expires.c DONE by Brian
mod_headers.c DONE by Brian
mod_imap.c DONE by Brian
- mod_include.c RESERVED by Brian
+ mod_include.c DONE by Brian
mod_info.c DONE by Ken
mod_log_agent.c DONE by Brian
mod_log_config.c DONE by Ken
mod_log_referer.c DONE by Brian
- mod_mime.c RESERVED by Brian
- mod_mime.h RESERVED by Brian
+ mod_mime.c DONE by Brian
+ mod_mime.h DONE by Brian
mod_mime_magic.c DONE by Brian
mod_negotiation.c DONE by Ken
mod_rewrite.c
1.12 +83 -73 apachen/src/modules/standard/mod_dld.c
Index: mod_dld.c
===================================================================
RCS file: /export/home/cvs/apachen/src/modules/standard/mod_dld.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- mod_dld.c 1997/08/18 13:12:11 1.11
+++ mod_dld.c 1997/09/18 18:49:37 1.12
@@ -57,7 +57,7 @@
#include "httpd.h"
#include "http_config.h"
-#include "http_conf_globals.h" /* server_argv0. Sigh... */
+#include "http_conf_globals.h" /* server_argv0. Sigh... */
#include <dld.h>
/*
@@ -66,128 +66,138 @@
* cheap way out: we only actually load the modules the first time through.
*/
-static int been_there_done_that = 0; /* Loaded the modules yet? */
+static int been_there_done_that = 0; /* Loaded the modules yet? */
static int have_symbol_table = 0;
static char *insure_dld_sane()
{
int errcode;
char *bin_name;
-
- if (have_symbol_table) return NULL;
- bin_name = dld_find_executable (server_argv0);
-
- if ((errcode = dld_init (bin_name))) {
- dld_perror (server_argv0);
- return "Cannot find server binary (needed for dynamic linking).";
+ if (have_symbol_table)
+ return NULL;
+
+ bin_name = dld_find_executable(server_argv0);
+
+ if ((errcode = dld_init(bin_name))) {
+ dld_perror(server_argv0);
+ return "Cannot find server binary (needed for dynamic linking).";
}
have_symbol_table = 1;
return NULL;
}
-static char *link_file (pool *p, char *filename)
+static char *link_file(pool *p, char *filename)
{
int errcode;
-
- filename = server_root_relative (p, filename);
- if ((errcode = dld_link (filename))) {
- dld_perror (server_argv0);
- return pstrcat (p, "Cannot load ", filename, " into server", NULL);
+
+ filename = server_root_relative(p, filename);
+ if ((errcode = dld_link(filename))) {
+ dld_perror(server_argv0);
+ return pstrcat(p, "Cannot load ", filename, " into server", NULL);
}
return NULL;
}
-static char *load_module (cmd_parms *cmd, void *dummy, char *modname, char *filename)
+static char *load_module(cmd_parms *cmd, void *dummy, char *modname, char *filename)
{
char *errname;
module *modp;
- if (been_there_done_that) return NULL;
-
- if ((errname = insure_dld_sane())) return errname;
- if ((errname = link_file (cmd->pool, filename))) return errname;
- if (!(modp = (module *)dld_get_symbol (modname))) {
- return pstrcat (cmd->pool, "Can't find module ", modname,
- " in file ", filename, NULL);
+ if (been_there_done_that)
+ return NULL;
+
+ if ((errname = insure_dld_sane()))
+ return errname;
+ if ((errname = link_file(cmd->pool, filename)))
+ return errname;
+ if (!(modp = (module *) dld_get_symbol(modname))) {
+ return pstrcat(cmd->pool, "Can't find module ", modname,
+ " in file ", filename, NULL);
}
- add_module (modp);
+ add_module(modp);
/* Alethea Patch (rws,djw2) - need to run configuration functions
in new modules */
if (modp->create_server_config)
- ((void**)cmd->server->module_config)[modp->module_index]=
- (*modp->create_server_config)(cmd->pool, cmd->server);
+ ((void **) cmd->server->module_config)[modp->module_index] =
+ (*modp->create_server_config) (cmd->pool, cmd->server);
if (modp->create_dir_config)
- ((void**)cmd->server->lookup_defaults)[modp->module_index]=
- (*modp->create_dir_config)(cmd->pool, NULL);
+ ((void **) cmd->server->lookup_defaults)[modp->module_index] =
+ (*modp->create_dir_config) (cmd->pool, NULL);
return NULL;
}
-static char *load_file (cmd_parms *cmd, void *dummy, char *filename)
+static char *load_file(cmd_parms *cmd, void *dummy, char *filename)
{
char *errname;
-
- if (been_there_done_that) return NULL;
-
- if ((errname = insure_dld_sane())) return errname;
- if ((errname = link_file (cmd->pool, filename))) return errname;
+
+ if (been_there_done_that)
+ return NULL;
+
+ if ((errname = insure_dld_sane()))
+ return errname;
+ if ((errname = link_file(cmd->pool, filename)))
+ return errname;
return NULL;
}
-static void check_loaded_modules (server_rec *dummy, pool *p)
+static void check_loaded_modules(server_rec *dummy, pool *p)
{
- if (been_there_done_that) return;
+ if (been_there_done_that)
+ return;
if (dld_undefined_sym_count > 0) {
- /* Screwup. Do the best we can to inform the user, and exit */
- char **bad_syms = dld_list_undefined_sym();
- int i;
-
- fprintf(stderr, "Dynamic linking error --- symbols left undefined.\n");
- fprintf(stderr, "(It may help to relink libraries).\n");
- fprintf(stderr, "Undefined symbols follow:\n");
-
- for (i = 0; i < dld_undefined_sym_count; ++i)
- fprintf (stderr, "%s\n", bad_syms[i]);
+ /* Screwup. Do the best we can to inform the user, and exit */
+ char **bad_syms = dld_list_undefined_sym();
+ int i;
+
+ fprintf(stderr, "Dynamic linking error --- symbols left undefined.\n");
+ fprintf(stderr, "(It may help to relink libraries).\n");
+ fprintf(stderr, "Undefined symbols follow:\n");
+
+ for (i = 0; i < dld_undefined_sym_count; ++i)
+ fprintf(stderr, "%s\n", bad_syms[i]);
- exit (1);
+ exit(1);
}
-
+
been_there_done_that = 1;
}
-static command_rec dld_cmds[] = {
-{ "LoadModule", load_module, NULL, RSRC_CONF, TAKE2,
- "a module name, and the name of a file to load it from"},
-{ "LoadFile", load_file, NULL, RSRC_CONF, ITERATE,
- "files or libraries to link into the server at runtime"},
-{ NULL }
+static command_rec dld_cmds[] =
+{
+ {"LoadModule", load_module, NULL, RSRC_CONF, TAKE2,
+ "a module name, and the name of a file to load it from"},
+ {"LoadFile", load_file, NULL, RSRC_CONF, ITERATE,
+ "files or libraries to link into the server at runtime"},
+ {NULL}
};
-module dld_module = {
- STANDARD_MODULE_STUFF,
- check_loaded_modules, /* initializer */
- NULL, /* create per-dir config */
- NULL, /* merge per-dir config */
- NULL, /* server config */
- NULL, /* merge server config */
- dld_cmds, /* command table */
- NULL, /* handlers */
- NULL, /* filename translation */
- NULL, /* check_user_id */
- NULL, /* check auth */
- NULL, /* check access */
- NULL, /* type_checker */
- NULL, /* logger */
- NULL, /* header parser */
- NULL, /* child_init */
- NULL, /* child_exit */
- NULL /* post read-request */
+module dld_module =
+{
+ STANDARD_MODULE_STUFF,
+ check_loaded_modules, /* initializer */
+ NULL, /* create per-dir config */
+ NULL, /* merge per-dir config */
+ NULL, /* server config */
+ NULL, /* merge server config */
+ dld_cmds, /* command table */
+ NULL, /* handlers */
+ NULL, /* filename translation */
+ NULL, /* check_user_id */
+ NULL, /* check auth */
+ NULL, /* check access */
+ NULL, /* type_checker */
+ NULL, /* logger */
+ NULL, /* header parser */
+ NULL, /* child_init */
+ NULL, /* child_exit */
+ NULL /* post read-request */
};
1.51 +681 -640 apachen/src/modules/standard/mod_include.c
Index: mod_include.c
===================================================================
RCS file: /export/home/cvs/apachen/src/modules/standard/mod_include.c,v
retrieving revision 1.50
retrieving revision 1.51
diff -u -r1.50 -r1.51
--- mod_include.c 1997/09/12 18:56:10 1.50
+++ mod_include.c 1997/09/18 18:49:38 1.51
@@ -98,7 +98,7 @@
/* ------------------------ Environment function -------------------------- */
-static void add_include_vars (request_rec *r, char *timefmt)
+static void add_include_vars(request_rec *r, char *timefmt)
{
#ifndef WIN32
struct passwd *pw;
@@ -116,23 +116,24 @@
pw = getpwuid(r->finfo.st_uid);
if (pw) {
table_set(e, "USER_NAME", pw->pw_name);
- } else {
+ }
+ else {
char uid[16];
- ap_snprintf(uid, sizeof(uid), "user#%lu", (unsigned long)r->finfo.st_uid);
+ ap_snprintf(uid, sizeof(uid), "user#%lu", (unsigned long) r->finfo.st_uid);
table_set(e, "USER_NAME", uid);
}
#endif /* ndef WIN32 */
if ((t = strrchr(r->filename, '/')))
- table_set (e, "DOCUMENT_NAME", ++t);
+ table_set(e, "DOCUMENT_NAME", ++t);
else
- table_set (e, "DOCUMENT_NAME", r->uri);
+ table_set(e, "DOCUMENT_NAME", r->uri);
if (r->args) {
- char *arg_copy = pstrdup (r->pool, r->args);
+ char *arg_copy = pstrdup(r->pool, r->args);
- unescape_url (arg_copy);
- table_set (e, "QUERY_STRING_UNESCAPED",
- escape_shell_cmd (r->pool, arg_copy));
+ unescape_url(arg_copy);
+ table_set(e, "QUERY_STRING_UNESCAPED",
+ escape_shell_cmd(r->pool, arg_copy));
}
}
@@ -152,7 +153,7 @@
if (outind == OUTBUFSIZE) { \
FLUSH_BUF(r) \
}; \
- }
+ }
/* there SHOULD be some error checking on the return value of
* rwrite, however it is unclear what the API for rwrite returning
@@ -188,7 +189,8 @@
c = (char)i; \
}
-static int find_string (FILE *in, char *str, request_rec *r, int printing) {
+static int find_string(FILE *in, char *str, request_rec *r, int printing)
+{
int x, l = strlen(str), p;
char outbuf[OUTBUFSIZE];
int outind = 0;
@@ -246,26 +248,27 @@
/* The following is a shrinking transformation, therefore safe. */
-static void decodehtml (char *s)
+static void decodehtml(char *s)
{
int val, i, j;
char *p = s;
char *ents;
- static char *entlist[MAXENTLEN+1] = {
- NULL, /* 0 */
- NULL, /* 1 */
- "lt\074gt\076", /* 2 */
- "amp\046ETH\320eth\360", /* 3 */
+ static char *entlist[MAXENTLEN + 1] =
+ {
+ NULL, /* 0 */
+ NULL, /* 1 */
+ "lt\074gt\076", /* 2 */
+ "amp\046ETH\320eth\360", /* 3 */
"quot\042Auml\304Euml\313Iuml\317Ouml\326Uuml\334auml\344euml\353\
-iuml\357ouml\366uuml\374yuml\377", /* 4 */
+iuml\357ouml\366uuml\374yuml\377", /* 4 */
"Acirc\302Aring\305AElig\306Ecirc\312Icirc\316Ocirc\324Ucirc\333\
THORN\336szlig\337acirc\342aring\345aelig\346ecirc\352icirc\356ocirc\364\
-ucirc\373thorn\376", /* 5 */
+ucirc\373thorn\376", /* 5 */
"Agrave\300Aacute\301Atilde\303Ccedil\307Egrave\310Eacute\311\
Igrave\314Iacute\315Ntilde\321Ograve\322Oacute\323Otilde\325Oslash\330\
Ugrave\331Uacute\332Yacute\335agrave\340aacute\341atilde\343ccedil\347\
egrave\350eacute\351igrave\354iacute\355ntilde\361ograve\362oacute\363\
-otilde\365oslash\370ugrave\371uacute\372yacute\375" /* 6 */
+otilde\365oslash\370ugrave\371uacute\372yacute\375" /* 6 */
};
for (; *s != '\0'; s++, p++) {
@@ -289,22 +292,24 @@
s += i;
if (j < i || val <= 8 || (val >= 11 && val <= 31) ||
(val >= 127 && val <= 160) || val >= 256)
- p--; /* no data to output */
+ p--; /* no data to output */
else
*p = val;
- } else{
+ }
+ else {
j = i - 1;
- if (i - 1 > MAXENTLEN || entlist[i - 1] == NULL) { /* wrong length */
+ if (i - 1 > MAXENTLEN || entlist[i - 1] == NULL) { /* wrong length */
*p = '&';
- continue; /* skip it */
+ continue; /* skip it */
}
for (ents = entlist[i - 1]; *ents != '\0'; ents += i)
- if (strncmp(s + 1, ents, i - 1) == 0) break;
+ if (strncmp(s + 1, ents, i - 1) == 0)
+ break;
if (*ents == '\0')
- *p = '&'; /* unknown */
+ *p = '&'; /* unknown */
else {
- *p = ((const unsigned char *)ents)[i - 1];
+ *p = ((const unsigned char *) ents)[i - 1];
s += i;
}
}
@@ -319,14 +324,14 @@
* the tag value is html decoded if dodecode is non-zero
*/
-static char *get_tag (pool *p, FILE *in, char *tag, int tagbuf_len, int dodecode)
+static char *get_tag(pool *p, FILE *in, char *tag, int tagbuf_len, int dodecode)
{
char *t = tag, *tag_val, c, term;
int n;
n = 0;
- do { /* skip whitespace */
+ do { /* skip whitespace */
GET_CHAR(in, c, NULL, p);
} while (isspace(c));
@@ -343,7 +348,7 @@
return tag;
}
}
- return NULL; /* failed */
+ return NULL; /* failed */
}
/* find end of tag name */
@@ -361,18 +366,19 @@
*t++ = '\0';
tag_val = t;
- while (isspace(c)) GET_CHAR(in, c, NULL, p); /* space before = */
+ while (isspace(c))
+ GET_CHAR(in, c, NULL, p); /* space before = */
if (c != '=') {
ungetc(c, in);
return NULL;
}
do {
- GET_CHAR(in, c, NULL, p); /* space after = */
+ GET_CHAR(in, c, NULL, p); /* space after = */
} while (isspace(c));
/* we should allow a 'name' as a value */
-
+
if (c != '"' && c != '\'')
return NULL;
term = c;
@@ -384,21 +390,22 @@
}
/* Want to accept \" as a valid character within a string. */
if (c == '\\') {
- *(t++) = c; /* Add backslash */
+ *(t++) = c; /* Add backslash */
GET_CHAR(in, c, NULL, p);
- if (c == term) /* Only if */
- *(--t) = c; /* Replace backslash ONLY for terminator */
- } else if (c == term)
+ if (c == term) /* Only if */
+ *(--t) = c; /* Replace backslash ONLY for terminator */
+ }
+ else if (c == term)
break;
*(t++) = c;
}
*t = '\0';
if (dodecode)
decodehtml(tag_val);
- return pstrdup (p, tag_val);
+ return pstrdup(p, tag_val);
}
-static int get_directive (FILE *in, char *d, pool *p)
+static int get_directive(FILE *in, char *d, pool *p)
{
char c;
@@ -423,77 +430,79 @@
* Do variable substitution on strings
*/
static void parse_string(request_rec *r, char *in, char *out, int length,
- int leave_name)
+ int leave_name)
{
char ch;
char *next = out;
int numchars = 0;
while ((ch = *in++) != '\0') {
- switch(ch) {
- case '\\':
+ switch (ch) {
+ case '\\':
if (*in == '$')
*next++ = *in++;
else
*next++ = ch;
break;
- case '$':
- {
- char var[MAX_STRING_LEN];
- char vtext[MAX_STRING_LEN];
- char *val;
- int braces = 0;
- int vlen, vtlen;
- /*
- * Keep the $ and { around because we do no substitution
- * if the variable isn't found
- */
- vlen = vtlen = 0;
- vtext[vtlen++] = ch;
- if (*in == '{') {
- braces = 1;
- vtext[vtlen++] = *in++;
- }
- while (*in != '\0') {
- if (vlen == (MAX_STRING_LEN - 1))
- continue;
- if (braces == 1) {
- if (*in == '}')
+ case '$':
+ {
+ char var[MAX_STRING_LEN];
+ char vtext[MAX_STRING_LEN];
+ char *val;
+ int braces = 0;
+ int vlen, vtlen;
+ /*
+ * Keep the $ and { around because we do no substitution
+ * if the variable isn't found
+ */
+ vlen = vtlen = 0;
+ vtext[vtlen++] = ch;
+ if (*in == '{') {
+ braces = 1;
+ vtext[vtlen++] = *in++;
+ }
+ while (*in != '\0') {
+ if (vlen == (MAX_STRING_LEN - 1))
+ continue;
+ if (braces == 1) {
+ if (*in == '}')
+ break;
+ }
+ else if (!(isalpha((int) *in) || (*in == '_') || isdigit((int) *in)))
break;
+ if (vtlen < (MAX_STRING_LEN - 1))
+ vtext[vtlen++] = *in;
+ var[vlen++] = *in++;
}
- else if (! (isalpha((int)*in) || (*in == '_') || isdigit((int)*in)) )
- break;
- if (vtlen < (MAX_STRING_LEN - 1))
- vtext[vtlen++] = *in;
- var[vlen++] = *in++;
- }
- var[vlen] = vtext[vtlen] = '\0';
- if (braces == 1) {
- if (*in != '}') {
- aplog_error(APLOG_MARK, APLOG_ERR, r->server,
- "Invalid variable \"%s%s\"", vtext, in);
- *next = '\0';
- return;
- } else
- in++;
- }
-
- val = (char *)NULL;
- if (var[0] == '\0') {
- val = &vtext[0];
- } else {
- val = table_get (r->subprocess_env, &var[0]);
- if (!val && leave_name)
+ var[vlen] = vtext[vtlen] = '\0';
+ if (braces == 1) {
+ if (*in != '}') {
+ aplog_error(APLOG_MARK, APLOG_ERR, r->server,
+ "Invalid variable \"%s%s\"", vtext, in);
+ *next = '\0';
+ return;
+ }
+ else
+ in++;
+ }
+
+ val = (char *) NULL;
+ if (var[0] == '\0') {
val = &vtext[0];
+ }
+ else {
+ val = table_get(r->subprocess_env, &var[0]);
+ if (!val && leave_name)
+ val = &vtext[0];
+ }
+ while ((val != (char *) NULL) && (*val != '\0')) {
+ *next++ = *val++;
+ if (++numchars == (length - 1))
+ break;
+ }
+ break;
}
- while ((val != (char *)NULL) && (*val != '\0')) {
- *next++ = *val++;
- if (++numchars == (length - 1))
- break;
- }
- break;
- }
- default:
+ default:
*next++ = ch;
break;
}
@@ -506,25 +515,25 @@
/* --------------------------- Action handlers ---------------------------- */
-static int include_cgi (char *s, request_rec *r)
+static int include_cgi(char *s, request_rec *r)
{
- request_rec *rr = sub_req_lookup_uri (s, r);
-
+ request_rec *rr = sub_req_lookup_uri(s, r);
+
if (rr->status != 200)
return -1;
-
+
/* No hardwired path info or query allowed */
-
+
if ((rr->path_info && rr->path_info[0]) || rr->args)
return -1;
if (rr->finfo.st_mode == 0)
return -1;
/* Script gets parameters of the *document*, for back compatibility */
-
- rr->path_info = r->path_info; /* painful to get right; see mod_cgi.c */
+
+ rr->path_info = r->path_info; /* painful to get right; see mod_cgi.c */
rr->args = r->args;
-
+
/* Force sub_req to be treated as a CGI request, even if ordinary
* typing rules would have called it something else.
*/
@@ -532,20 +541,20 @@
rr->content_type = CGI_MAGIC_TYPE;
/* Run it. */
-
- if (run_sub_req (rr) == REDIRECT) {
- char *location = table_get (rr->headers_out, "Location");
+
+ if (run_sub_req(rr) == REDIRECT) {
+ char *location = table_get(rr->headers_out, "Location");
location = escape_html(rr->pool, location);
rvputs(r, "<A HREF=\"", location, "\">", location, "</A>", NULL);
}
-
- destroy_sub_req (rr);
+
+ destroy_sub_req(rr);
chdir_file(r->filename);
-
+
return 0;
}
-static int handle_include (FILE *in, request_rec *r, char *error, int noexec)
+static int handle_include(FILE *in, request_rec *r, char *error, int noexec)
{
char tag[MAX_STRING_LEN];
char parsed_string[MAX_STRING_LEN];
@@ -553,30 +562,31 @@
while (1) {
if (!(tag_val = get_tag(r->pool, in, tag, MAX_STRING_LEN, 1)))
- return 1;
- if (!strcmp(tag, "file") || !strcmp (tag, "virtual")) {
+ return 1;
+ if (!strcmp(tag, "file") || !strcmp(tag, "virtual")) {
request_rec *rr = NULL;
char *error_fmt = NULL;
parse_string(r, tag_val, parsed_string, MAX_STRING_LEN, 0);
if (tag[0] == 'f') {
- /* be safe; only files in this directory or below allowed */
- char tmp[MAX_STRING_LEN+2];
+ /* be safe; only files in this directory or below allowed */
+ char tmp[MAX_STRING_LEN + 2];
ap_snprintf(tmp, sizeof(tmp), "/%s/", parsed_string);
if (parsed_string[0] == '/' || strstr(tmp, "/../") != NULL)
error_fmt = "unable to include file \"%s\" in parsed file %s";
else
- rr = sub_req_lookup_file (parsed_string, r);
- } else
- rr = sub_req_lookup_uri (parsed_string, r);
-
+ rr = sub_req_lookup_file(parsed_string, r);
+ }
+ else
+ rr = sub_req_lookup_uri(parsed_string, r);
+
if (!error_fmt && rr->status != 200)
error_fmt = "unable to include \"%s\" in parsed file %s";
if (!error_fmt && noexec && rr->content_type
- && (strncmp (rr->content_type, "text/", 5)))
+ && (strncmp(rr->content_type, "text/", 5)))
error_fmt =
- "unable to include potential exec \"%s\" in parsed file %s";
+ "unable to include potential exec \"%s\" in parsed file %s";
if (error_fmt == NULL) {
request_rec *p;
@@ -586,26 +596,26 @@
if (p != NULL)
error_fmt = "Recursive include of \"%s\" in parsed file %s";
}
-
- if (!error_fmt && run_sub_req (rr))
+
+ if (!error_fmt && run_sub_req(rr))
error_fmt = "unable to include \"%s\" in parsed file %s";
chdir_file(r->filename);
-
+
if (error_fmt) {
aplog_error(APLOG_MARK, APLOG_ERR, r->server,
- error_fmt, tag_val, r->filename);
+ error_fmt, tag_val, r->filename);
rputs(error, r);
- }
+ }
if (rr != NULL)
- destroy_sub_req (rr);
- }
+ destroy_sub_req(rr);
+ }
else if (!strcmp(tag, "done"))
return 0;
else {
aplog_error(APLOG_MARK, APLOG_ERR, r->server,
- "unknown parameter \"%s\" to tag include in %s",
- tag, r->filename);
+ "unknown parameter \"%s\" to tag include in %s",
+ tag, r->filename);
rputs(error, r);
}
}
@@ -616,33 +626,33 @@
char *s;
} include_cmd_arg;
-static int include_cmd_child (void *arg)
+static int include_cmd_child(void *arg)
{
- request_rec *r = ((include_cmd_arg *)arg)->r;
- char *s = ((include_cmd_arg *)arg)->s;
+ request_rec *r = ((include_cmd_arg *) arg)->r;
+ char *s = ((include_cmd_arg *) arg)->s;
table *env = r->subprocess_env;
int child_pid = 0;
-#ifdef DEBUG_INCLUDE_CMD
- FILE *dbg = fopen ("/dev/tty", "w");
+#ifdef DEBUG_INCLUDE_CMD
+ FILE *dbg = fopen("/dev/tty", "w");
#endif
#ifndef WIN32
- char err_string [MAX_STRING_LEN];
+ char err_string[MAX_STRING_LEN];
#endif
-#ifdef DEBUG_INCLUDE_CMD
+#ifdef DEBUG_INCLUDE_CMD
#ifdef __EMX__
/* under OS/2 /dev/tty is referenced as con */
- FILE *dbg = fopen ("con", "w");
+ FILE *dbg = fopen("con", "w");
#else
- fprintf (dbg, "Attempting to include command '%s'\n", s);
-#endif
-#endif
+ fprintf(dbg, "Attempting to include command '%s'\n", s);
+#endif
+#endif
if (r->path_info && r->path_info[0] != '\0') {
request_rec *pa_req;
- table_set (env, "PATH_INFO", escape_shell_cmd (r->pool, r->path_info));
-
+ table_set(env, "PATH_INFO", escape_shell_cmd(r->pool, r->path_info));
+
pa_req = sub_req_lookup_uri(escape_uri(r->pool, r->path_info), r);
if (pa_req->filename)
table_set(env, "PATH_TRANSLATED",
@@ -651,53 +661,54 @@
}
if (r->args) {
- char *arg_copy = pstrdup (r->pool, r->args);
+ char *arg_copy = pstrdup(r->pool, r->args);
+
+ table_set(env, "QUERY_STRING", r->args);
+ unescape_url(arg_copy);
+ table_set(env, "QUERY_STRING_UNESCAPED",
+ escape_shell_cmd(r->pool, arg_copy));
+ }
- table_set (env, "QUERY_STRING", r->args);
- unescape_url (arg_copy);
- table_set (env, "QUERY_STRING_UNESCAPED",
- escape_shell_cmd (r->pool, arg_copy));
- }
-
- error_log2stderr (r->server);
-
-#ifdef DEBUG_INCLUDE_CMD
- fprintf (dbg, "Attempting to exec '%s'\n", s);
-#endif
+ error_log2stderr(r->server);
+
+#ifdef DEBUG_INCLUDE_CMD
+ fprintf(dbg, "Attempting to exec '%s'\n", s);
+#endif
cleanup_for_exec();
/* set shellcmd flag to pass arg to SHELL_PATH */
- child_pid = call_exec(r, s, create_environment (r->pool, env), 1);
+ child_pid = call_exec(r, s, create_environment(r->pool, env), 1);
#ifdef WIN32
- return(child_pid);
-#else
+ return (child_pid);
+#else
/* Oh, drat. We're still here. The log file descriptors are closed,
* so we have to whimper a complaint onto stderr...
*/
-
-#ifdef DEBUG_INCLUDE_CMD
- fprintf (dbg, "Exec failed\n");
-#endif
+
+#ifdef DEBUG_INCLUDE_CMD
+ fprintf(dbg, "Exec failed\n");
+#endif
ap_snprintf(err_string, sizeof(err_string),
- "httpd: exec of %s failed, reason: %s (errno = %d)\n",
- SHELL_PATH, strerror(errno), errno);
- write (STDERR_FILENO, err_string, strlen(err_string));
+ "httpd: exec of %s failed, reason: %s (errno = %d)\n",
+ SHELL_PATH, strerror(errno), errno);
+ write(STDERR_FILENO, err_string, strlen(err_string));
exit(0);
/* NOT REACHED */
- return(child_pid);
+ return (child_pid);
#endif /* WIN32 */
}
-static int include_cmd (char *s, request_rec *r)
+static int include_cmd(char *s, request_rec *r)
{
include_cmd_arg arg;
FILE *f;
- arg.r = r; arg.s = s;
+ arg.r = r;
+ arg.s = s;
+
+ if (!spawn_child(r->pool, include_cmd_child, &arg,
+ kill_after_timeout, NULL, &f))
+ return -1;
- if (!spawn_child (r->pool, include_cmd_child, &arg,
- kill_after_timeout, NULL, &f))
- return -1;
-
send_fd(f, r);
pfclose(r->pool, f); /* will wait for zombie when
* r->pool is cleared
@@ -706,7 +717,7 @@
}
-static int handle_exec (FILE *in, request_rec *r, char *error)
+static int handle_exec(FILE *in, request_rec *r, char *error)
{
char tag[MAX_STRING_LEN];
char *tag_val;
@@ -714,24 +725,24 @@
char parsed_string[MAX_STRING_LEN];
while (1) {
- if (!(tag_val = get_tag (r->pool, in, tag, MAX_STRING_LEN, 1)))
- return 1;
+ if (!(tag_val = get_tag(r->pool, in, tag, MAX_STRING_LEN, 1)))
+ return 1;
if (!strcmp(tag, "cmd")) {
parse_string(r, tag_val, parsed_string, MAX_STRING_LEN, 1);
if (include_cmd(parsed_string, r) == -1) {
aplog_error(APLOG_MARK, APLOG_ERR, r->server,
- "execution failure for parameter \"%s\" to tag exec in file %s",
- tag, r->filename);
+ "execution failure for parameter \"%s\" to tag exec in file %s",
+ tag, r->filename);
rputs(error, r);
}
/* just in case some stooge changed directories */
chdir_file(r->filename);
- }
+ }
else if (!strcmp(tag, "cgi")) {
parse_string(r, tag_val, parsed_string, MAX_STRING_LEN, 0);
if (include_cgi(parsed_string, r) == -1) {
aplog_error(APLOG_MARK, APLOG_ERR, r->server,
- "invalid CGI ref \"%s\" in %s", tag_val, file);
+ "invalid CGI ref \"%s\" in %s", tag_val, file);
rputs(error, r);
}
/* grumble groan */
@@ -741,62 +752,62 @@
return 0;
else {
aplog_error(APLOG_MARK, APLOG_ERR, r->server,
- "unknown parameter \"%s\" to tag exec in %s",
- tag, file);
+ "unknown parameter \"%s\" to tag exec in %s",
+ tag, file);
rputs(error, r);
}
}
}
-static int handle_echo (FILE *in, request_rec *r, char *error)
+static int handle_echo(FILE *in, request_rec *r, char *error)
{
char tag[MAX_STRING_LEN];
char *tag_val;
while (1) {
if (!(tag_val = get_tag(r->pool, in, tag, MAX_STRING_LEN, 1)))
- return 1;
+ return 1;
if (!strcmp(tag, "var")) {
char *val = table_get(r->subprocess_env, tag_val);
if (val)
rputs(val, r);
else
- rputs("(none)", r);
+ rputs("(none)", r);
}
- else if (!strcmp(tag, "done"))
+ else if (!strcmp(tag, "done"))
return 0;
else {
aplog_error(APLOG_MARK, APLOG_ERR, r->server,
- "unknown parameter \"%s\" to tag echo in %s",
- tag, r->filename);
+ "unknown parameter \"%s\" to tag echo in %s",
+ tag, r->filename);
rputs(error, r);
}
}
}
#ifdef USE_PERL_SSI
-static int handle_perl (FILE *in, request_rec *r, char *error)
+static int handle_perl(FILE *in, request_rec *r, char *error)
{
char tag[MAX_STRING_LEN];
char *tag_val;
SV *sub = Nullsv;
- AV *av = newAV();
+ AV *av = newAV();
- if (!(allow_options (r) & OPT_INCLUDES)) {
+ if (!(allow_options(r) & OPT_INCLUDES)) {
aplog_error(APLOG_MARK, APLOG_ERR, r->server,
- "httpd: #perl SSI disallowed by IncludesNoExec in %s",
- r->filename);
+ "httpd: #perl SSI disallowed by IncludesNoExec in %s",
+ r->filename);
return DECLINED;
}
while (1) {
- if (!(tag_val = get_tag (r->pool, in, tag, MAX_STRING_LEN, 1)))
- break;
- if (strnEQ(tag, "sub", 3))
+ if (!(tag_val = get_tag(r->pool, in, tag, MAX_STRING_LEN, 1)))
+ break;
+ if (strnEQ(tag, "sub", 3))
sub = newSVpv(tag_val, 0);
- else if (strnEQ(tag, "arg", 3))
- av_push(av, newSVpv(tag_val, 0));
+ else if (strnEQ(tag, "arg", 3))
+ av_push(av, newSVpv(tag_val, 0));
else if (strnEQ(tag, "done", 4))
break;
}
@@ -809,8 +820,8 @@
/* error and tf must point to a string with room for at
* least MAX_STRING_LEN characters
*/
-static int handle_config (FILE *in, request_rec *r, char *error, char *tf,
- int *sizefmt)
+static int handle_config(FILE *in, request_rec *r, char *error, char *tf,
+ int *sizefmt)
{
char tag[MAX_STRING_LEN];
char *tag_val;
@@ -819,19 +830,20 @@
while (1) {
if (!(tag_val = get_tag(r->pool, in, tag, MAX_STRING_LEN, 0)))
- return 1;
+ return 1;
if (!strcmp(tag, "errmsg")) {
parse_string(r, tag_val, parsed_string, MAX_STRING_LEN, 0);
strncpy(error, parsed_string, MAX_STRING_LEN - 1);
error[MAX_STRING_LEN - 1] = '\0';
- } else if (!strcmp(tag, "timefmt")) {
+ }
+ else if (!strcmp(tag, "timefmt")) {
time_t date = r->request_time;
parse_string(r, tag_val, parsed_string, MAX_STRING_LEN, 0);
strncpy(tf, parsed_string, MAX_STRING_LEN - 1);
tf[MAX_STRING_LEN - 1] = '\0';
- table_set (env, "DATE_LOCAL", ht_time(r->pool, date, tf, 0));
- table_set (env, "DATE_GMT", ht_time(r->pool, date, tf, 1));
- table_set (env, "LAST_MODIFIED", ht_time(r->pool, r->finfo.st_mtime, tf, 0));
+ table_set(env, "DATE_LOCAL", ht_time(r->pool, date, tf, 0));
+ table_set(env, "DATE_GMT", ht_time(r->pool, date, tf, 1));
+ table_set(env, "LAST_MODIFIED", ht_time(r->pool, r->finfo.st_mtime, tf, 0));
}
else if (!strcmp(tag, "sizefmt")) {
parse_string(r, tag_val, parsed_string, MAX_STRING_LEN, 0);
@@ -840,49 +852,49 @@
*sizefmt = SIZEFMT_BYTES;
else if (!strcmp(parsed_string, "abbrev"))
*sizefmt = SIZEFMT_KMG;
- }
+ }
else if (!strcmp(tag, "done"))
return 0;
else {
aplog_error(APLOG_MARK, APLOG_ERR, r->server,
- "unknown parameter \"%s\" to tag config in %s",
- tag, r->filename);
+ "unknown parameter \"%s\" to tag config in %s",
+ tag, r->filename);
rputs(error, r);
}
}
}
-static int find_file (request_rec *r, char *directive, char *tag,
- char *tag_val, struct stat *finfo, char *error)
+static int find_file(request_rec *r, char *directive, char *tag,
+ char *tag_val, struct stat *finfo, char *error)
{
char *dir = "./";
char *to_send;
if (!strcmp(tag, "file")) {
- getparents(tag_val); /* get rid of any nasties */
- to_send = make_full_path (r->pool, dir, tag_val);
+ getparents(tag_val); /* get rid of any nasties */
+ to_send = make_full_path(r->pool, dir, tag_val);
if (stat(to_send, finfo) == -1) {
aplog_error(APLOG_MARK, APLOG_ERR, r->server,
- "unable to get information about \"%s\" in parsed file %s",
- to_send, r->filename);
+ "unable to get information about \"%s\" in parsed file %s",
+ to_send, r->filename);
rputs(error, r);
return -1;
}
return 0;
}
else if (!strcmp(tag, "virtual")) {
- request_rec *rr = sub_req_lookup_uri (tag_val, r);
-
+ request_rec *rr = sub_req_lookup_uri(tag_val, r);
+
if (rr->status == 200 && rr->finfo.st_mode != 0) {
- memcpy((char*)finfo, (const char *)&rr->finfo, sizeof (struct stat));
+ memcpy((char *) finfo, (const char *) &rr->finfo, sizeof(struct stat));
destroy_sub_req(rr);
return 0;
}
- else {
+ else {
aplog_error(APLOG_MARK, APLOG_ERR, r->server,
- "unable to get information about \"%s\" in parsed file %s",
- tag_val, r->filename);
+ "unable to get information about \"%s\" in parsed file %s",
+ tag_val, r->filename);
rputs(error, r);
destroy_sub_req(rr);
return -1;
@@ -890,15 +902,15 @@
}
else {
aplog_error(APLOG_MARK, APLOG_ERR, r->server,
- "unknown parameter \"%s\" to tag %s in %s",
- tag, directive, r->filename);
+ "unknown parameter \"%s\" to tag %s in %s",
+ tag, directive, r->filename);
rputs(error, r);
return -1;
}
}
-static int handle_fsize (FILE *in, request_rec *r, char *error, int sizefmt)
+static int handle_fsize(FILE *in, request_rec *r, char *error, int sizefmt)
{
char tag[MAX_STRING_LEN];
char *tag_val;
@@ -907,7 +919,7 @@
while (1) {
if (!(tag_val = get_tag(r->pool, in, tag, MAX_STRING_LEN, 1)))
- return 1;
+ return 1;
else if (!strcmp(tag, "done"))
return 0;
else {
@@ -924,12 +936,12 @@
#else
ap_snprintf(tag, sizeof(tag), "%ld", finfo.st_size);
#endif
- l = strlen(tag); /* grrr */
+ l = strlen(tag); /* grrr */
for (x = 0; x < l; x++) {
if (x && (!((l - x) % 3))) {
rputc(',', r);
}
- rputc (tag[x], r);
+ rputc(tag[x], r);
}
}
}
@@ -937,7 +949,7 @@
}
}
-static int handle_flastmod (FILE *in, request_rec *r, char *error, char *tf)
+static int handle_flastmod(FILE *in, request_rec *r, char *error, char *tf)
{
char tag[MAX_STRING_LEN];
char *tag_val;
@@ -946,7 +958,7 @@
while (1) {
if (!(tag_val = get_tag(r->pool, in, tag, MAX_STRING_LEN, 1)))
- return 1;
+ return 1;
else if (!strcmp(tag, "done"))
return 0;
else {
@@ -955,25 +967,26 @@
rputs(ht_time(r->pool, finfo.st_mtime, tf, 0), r);
}
}
-}
+}
-static int re_check (request_rec *r, char *string, char *rexp)
+static int re_check(request_rec *r, char *string, char *rexp)
{
regex_t *compiled;
int regex_error;
- compiled = pregcomp(r->pool, rexp, REG_EXTENDED|REG_NOSUB);
+ compiled = pregcomp(r->pool, rexp, REG_EXTENDED | REG_NOSUB);
if (compiled == NULL) {
aplog_error(APLOG_MARK, APLOG_ERR, r->server,
- "unable to compile pattern \"%s\"", rexp);
+ "unable to compile pattern \"%s\"", rexp);
return -1;
}
- regex_error = regexec(compiled, string, 0, (regmatch_t *)NULL, 0);
+ regex_error = regexec(compiled, string, 0, (regmatch_t *) NULL, 0);
pregfree(r->pool, compiled);
- return(!regex_error);
+ return (!regex_error);
}
-enum token_type { token_string,
+enum token_type {
+ token_string,
token_and, token_or, token_not, token_eq, token_ne,
token_rbrace, token_lbrace, token_group,
token_ge, token_le, token_gt, token_lt
@@ -983,70 +996,73 @@
char value[MAX_STRING_LEN];
};
-static char *get_ptoken (request_rec *r, char *string, struct token *token)
+static char *get_ptoken(request_rec *r, char *string, struct token *token)
{
char ch;
int next = 0;
int qs = 0;
/* Skip leading white space */
- if (string == (char *)NULL)
- return (char *)NULL;
+ if (string == (char *) NULL)
+ return (char *) NULL;
while ((ch = *string++))
if (!isspace(ch))
break;
if (ch == '\0')
- return (char *)NULL;
+ return (char *) NULL;
- switch(ch) {
- case '(':
+ switch (ch) {
+ case '(':
token->type = token_lbrace;
- return(string);
- case ')':
+ return (string);
+ case ')':
token->type = token_rbrace;
- return(string);
- case '=':
+ return (string);
+ case '=':
token->type = token_eq;
- return(string);
- case '!':
+ return (string);
+ case '!':
if (*string == '=') {
token->type = token_ne;
- return(string+1);
- } else {
+ return (string + 1);
+ }
+ else {
token->type = token_not;
- return(string);
+ return (string);
}
- case '\'':
+ case '\'':
token->type = token_string;
qs = 1;
break;
- case '|':
+ case '|':
if (*string == '|') {
token->type = token_or;
- return(string+1);
+ return (string + 1);
}
- case '&':
+ case '&':
if (*string == '&') {
token->type = token_and;
- return(string+1);
+ return (string + 1);
}
- case '>':
+ case '>':
if (*string == '=') {
token->type = token_ge;
- return(string+1);
- } else {
+ return (string + 1);
+ }
+ else {
token->type = token_gt;
- return(string);
+ return (string);
}
- case '<':
+ case '<':
if (*string == '=') {
token->type = token_le;
- return(string+1);
- } else {
+ return (string + 1);
+ }
+ else {
token->type = token_lt;
- return(string);
+ return (string);
}
- default:
+ default:
token->type = token_string;
break;
}
@@ -1058,11 +1074,11 @@
* Yes I know that goto's are BAD. But, c doesn't allow me to
* exit a loop from a switch statement. Yes, I could use a flag,
* but that is (IMHO) even less readable/maintainable than the goto.
- */
+ */
/*
* I used the ++string throughout this section so that string
* ends up pointing to the next token and I can just return it
- */
+ */
for (ch = *string; ch != '\0'; ch = *++string) {
if (ch == '\\') {
if ((ch = *++string) == '\0')
@@ -1073,28 +1089,29 @@
if (!qs) {
if (isspace(ch))
goto TOKEN_DONE;
- switch(ch) {
- case '(':
+ switch (ch) {
+ case '(':
goto TOKEN_DONE;
- case ')':
+ case ')':
goto TOKEN_DONE;
- case '=':
+ case '=':
goto TOKEN_DONE;
- case '!':
+ case '!':
goto TOKEN_DONE;
- case '|':
- if (*(string+1) == '|')
+ case '|':
+ if (*(string + 1) == '|')
goto TOKEN_DONE;
- case '&':
- if (*(string+1) == '&')
+ case '&':
+ if (*(string + 1) == '&')
goto TOKEN_DONE;
- case '<':
+ case '<':
+ goto TOKEN_DONE;
+ case '>':
goto TOKEN_DONE;
- case '>': goto
- TOKEN_DONE;
}
token->value[next++] = ch;
- } else {
+ }
+ else {
if (ch == '\'') {
qs = 0;
++string;
@@ -1103,14 +1120,14 @@
token->value[next++] = ch;
}
}
-TOKEN_DONE:
+ TOKEN_DONE:
/* If qs is still set, I have an unmatched ' */
if (qs) {
rputs("\nUnmatched '\n", r);
next = 0;
}
token->value[next] = '\0';
- return(string);
+ return (string);
}
@@ -1121,126 +1138,127 @@
* cases. And, without rewriting this completely, the easiest way
* is to just branch to the return code which cleans it up.
*/
-static int parse_expr (request_rec *r, char *expr, char *error)
+static int parse_expr(request_rec *r, char *expr, char *error)
{
struct parse_node {
struct parse_node *left, *right, *parent;
struct token token;
int value, done;
- } *root, *current, *new;
+ } *root, *current, *new;
char *parse;
char buffer[MAX_STRING_LEN];
pool *expr_pool;
int retval = 0;
- if ((parse = expr) == (char *)NULL)
- return(0);
- root = current = (struct parse_node*)NULL;
- if ((expr_pool = make_sub_pool(r->pool)) == (pool *)NULL) {
+ if ((parse = expr) == (char *) NULL)
+ return (0);
+ root = current = (struct parse_node *) NULL;
+ if ((expr_pool = make_sub_pool(r->pool)) == (pool *) NULL) {
aplog_error(APLOG_MARK, APLOG_ERR, r->server,
- "out of memory processing file %s", r->filename);
+ "out of memory processing file %s", r->filename);
rputs(error, r);
- return(0);
+ return (0);
}
/* Create Parse Tree */
while (1) {
- new = (struct parse_node*)palloc(expr_pool, sizeof (struct parse_node));
- if (new == (struct parse_node*)NULL) {
+ new = (struct parse_node *) palloc(expr_pool, sizeof(struct parse_node));
+ if (new == (struct parse_node *) NULL) {
aplog_error(APLOG_MARK, APLOG_ERR, r->server,
- "out of memory processing file %s", r->filename);
+ "out of memory processing file %s", r->filename);
rputs(error, r);
goto RETURN;
}
- new->parent = new->left = new->right = (struct parse_node*)NULL;
+ new->parent = new->left = new->right = (struct parse_node *) NULL;
new->done = 0;
- if ((parse = get_ptoken(r, parse, &new->token)) == (char *)NULL)
+ if ((parse = get_ptoken(r, parse, &new->token)) == (char *) NULL)
break;
- switch(new->token.type) {
+ switch (new->token.type) {
- case token_string:
+ case token_string:
#ifdef DEBUG_INCLUDE
rvputs(r, " Token: string (", new->token.value, ")\n", NULL);
#endif
- if (current == (struct parse_node*)NULL) {
+ if (current == (struct parse_node *) NULL) {
root = current = new;
break;
}
- switch(current->token.type) {
- case token_string:
+ switch (current->token.type) {
+ case token_string:
if (current->token.value[0] != '\0')
- strncat(current->token.value, " ",
- MAX_STRING_LEN - strlen(current->token.value) - 1);
- strncat(current->token.value, new->token.value,
+ strncat(current->token.value, " ",
+ MAX_STRING_LEN - strlen(current->token.value) - 1);
+ strncat(current->token.value, new->token.value,
MAX_STRING_LEN - strlen(current->token.value) - 1);
break;
- case token_eq:
- case token_ne:
- case token_and:
- case token_or:
- case token_lbrace:
- case token_not:
- case token_ge:
- case token_gt:
- case token_le:
- case token_lt:
+ case token_eq:
+ case token_ne:
+ case token_and:
+ case token_or:
+ case token_lbrace:
+ case token_not:
+ case token_ge:
+ case token_gt:
+ case token_le:
+ case token_lt:
new->parent = current;
current = current->right = new;
break;
- default:
+ default:
aplog_error(APLOG_MARK, APLOG_ERR, r->server,
- "Invalid expression \"%s\" in file %s",
- expr, r->filename);
+ "Invalid expression \"%s\" in file %s",
+ expr, r->filename);
rputs(error, r);
goto RETURN;
}
break;
- case token_and:
- case token_or:
+ case token_and:
+ case token_or:
#ifdef DEBUG_INCLUDE
-rputs (" Token: and/or\n", r);
+ rputs(" Token: and/or\n", r);
#endif
- if (current == (struct parse_node*)NULL) {
+ if (current == (struct parse_node *) NULL) {
aplog_error(APLOG_MARK, APLOG_ERR, r->server,
- "Invalid expression \"%s\" in file %s",
- expr, r->filename);
+ "Invalid expression \"%s\" in file %s",
+ expr, r->filename);
rputs(error, r);
goto RETURN;
}
/* Percolate upwards */
- while (current != (struct parse_node *)NULL) {
- switch(current->token.type) {
- case token_string:
- case token_group:
- case token_not:
- case token_eq:
- case token_ne:
- case token_and:
- case token_or:
- case token_ge:
- case token_gt:
- case token_le:
- case token_lt:
+ while (current != (struct parse_node *) NULL) {
+ switch (current->token.type) {
+ case token_string:
+ case token_group:
+ case token_not:
+ case token_eq:
+ case token_ne:
+ case token_and:
+ case token_or:
+ case token_ge:
+ case token_gt:
+ case token_le:
+ case token_lt:
current = current->parent;
continue;
- case token_lbrace:
+ case token_lbrace:
break;
- default:
+ default:
aplog_error(APLOG_MARK, APLOG_ERR, r->server,
- "Invalid expression \"%s\" in file %s",
- expr, r->filename);
+ "Invalid expression \"%s\" in file %s",
+ expr, r->filename);
rputs(error, r);
goto RETURN;
}
break;
}
- if (current == (struct parse_node*)NULL) {
+ if (current == (struct parse_node *) NULL) {
new->left = root;
new->left->parent = new;
- new->parent = (struct parse_node*)NULL;
+ new->parent = (struct parse_node *) NULL;
root = new;
- } else {
+ }
+ else {
new->left = current->right;
current->right = new;
new->parent = current;
@@ -1248,43 +1266,44 @@
current = new;
break;
- case token_not:
+ case token_not:
#ifdef DEBUG_INCLUDE
-rputs(" Token: not\n", r);
+ rputs(" Token: not\n", r);
#endif
- if (current == (struct parse_node*)NULL) {
+ if (current == (struct parse_node *) NULL) {
root = current = new;
break;
}
/* Percolate upwards */
- while (current != (struct parse_node *)NULL) {
- switch(current->token.type) {
- case token_not:
- case token_eq:
- case token_ne:
- case token_and:
- case token_or:
- case token_lbrace:
- case token_ge:
- case token_gt:
- case token_le:
- case token_lt:
+ while (current != (struct parse_node *) NULL) {
+ switch (current->token.type) {
+ case token_not:
+ case token_eq:
+ case token_ne:
+ case token_and:
+ case token_or:
+ case token_lbrace:
+ case token_ge:
+ case token_gt:
+ case token_le:
+ case token_lt:
break;
- default:
+ default:
aplog_error(APLOG_MARK, APLOG_ERR, r->server,
- "Invalid expression \"%s\" in file %s",
- expr, r->filename);
+ "Invalid expression \"%s\" in file %s",
+ expr, r->filename);
rputs(error, r);
goto RETURN;
}
break;
}
- if (current == (struct parse_node*)NULL) {
+ if (current == (struct parse_node *) NULL) {
new->left = root;
new->left->parent = new;
- new->parent = (struct parse_node*)NULL;
+ new->parent = (struct parse_node *) NULL;
root = new;
- } else {
+ }
+ else {
new->left = current->right;
current->right = new;
new->parent = current;
@@ -1292,55 +1311,56 @@
current = new;
break;
- case token_eq:
- case token_ne:
- case token_ge:
- case token_gt:
- case token_le:
- case token_lt:
+ case token_eq:
+ case token_ne:
+ case token_ge:
+ case token_gt:
+ case token_le:
+ case token_lt:
#ifdef DEBUG_INCLUDE
-rputs(" Token: eq/ne/ge/gt/le/lt\n", r);
+ rputs(" Token: eq/ne/ge/gt/le/lt\n", r);
#endif
- if (current == (struct parse_node*)NULL) {
+ if (current == (struct parse_node *) NULL) {
aplog_error(APLOG_MARK, APLOG_ERR, r->server,
- "Invalid expression \"%s\" in file %s",
- expr, r->filename);
+ "Invalid expression \"%s\" in file %s",
+ expr, r->filename);
rputs(error, r);
goto RETURN;
}
/* Percolate upwards */
- while (current != (struct parse_node *)NULL) {
- switch(current->token.type) {
- case token_string:
- case token_group:
+ while (current != (struct parse_node *) NULL) {
+ switch (current->token.type) {
+ case token_string:
+ case token_group:
current = current->parent;
continue;
- case token_lbrace:
- case token_and:
- case token_or:
+ case token_lbrace:
+ case token_and:
+ case token_or:
break;
- case token_not:
- case token_eq:
- case token_ne:
- case token_ge:
- case token_gt:
- case token_le:
- case token_lt:
- default:
- aplog_error(APLOG_MARK, APLOG_ERR, r->server,
- "Invalid expression \"%s\" in file %s",
- expr, r->filename);
+ case token_not:
+ case token_eq:
+ case token_ne:
+ case token_ge:
+ case token_gt:
+ case token_le:
+ case token_lt:
+ default:
+ aplog_error(APLOG_MARK, APLOG_ERR, r->server,
+ "Invalid expression \"%s\" in file %s",
+ expr, r->filename);
rputs(error, r);
goto RETURN;
}
break;
}
- if (current == (struct parse_node*)NULL) {
+ if (current == (struct parse_node *) NULL) {
new->left = root;
new->left->parent = new;
- new->parent = (struct parse_node*)NULL;
+ new->parent = (struct parse_node *) NULL;
root = new;
- } else {
+ }
+ else {
new->left = current->right;
current->right = new;
new->parent = current;
@@ -1348,82 +1368,83 @@
current = new;
break;
- case token_rbrace:
+ case token_rbrace:
#ifdef DEBUG_INCLUDE
-rputs(" Token: rbrace\n", r);
+ rputs(" Token: rbrace\n", r);
#endif
- while (current != (struct parse_node*)NULL) {
+ while (current != (struct parse_node *) NULL) {
if (current->token.type == token_lbrace) {
current->token.type = token_group;
break;
}
current = current->parent;
}
- if (current == (struct parse_node*)NULL) {
+ if (current == (struct parse_node *) NULL) {
aplog_error(APLOG_MARK, APLOG_ERR, r->server,
- "Unmatched ')' in %s", expr, r->filename);
+ "Unmatched ')' in %s", expr, r->filename);
rputs(error, r);
goto RETURN;
}
break;
- case token_lbrace:
+ case token_lbrace:
#ifdef DEBUG_INCLUDE
-rputs(" Token: lbrace\n", r);
+ rputs(" Token: lbrace\n", r);
#endif
- if (current == (struct parse_node*)NULL) {
+ if (current == (struct parse_node *) NULL) {
root = current = new;
break;
}
/* Percolate upwards */
- while (current != (struct parse_node *)NULL) {
- switch(current->token.type) {
- case token_not:
- case token_eq:
- case token_ne:
- case token_and:
- case token_or:
- case token_lbrace:
- case token_ge:
- case token_gt:
- case token_le:
- case token_lt:
+ while (current != (struct parse_node *) NULL) {
+ switch (current->token.type) {
+ case token_not:
+ case token_eq:
+ case token_ne:
+ case token_and:
+ case token_or:
+ case token_lbrace:
+ case token_ge:
+ case token_gt:
+ case token_le:
+ case token_lt:
break;
- case token_string:
- case token_group:
- default:
+ case token_string:
+ case token_group:
+ default:
aplog_error(APLOG_MARK, APLOG_ERR, r->server,
- "Invalid expression \"%s\" in file %s",
- expr, r->filename);
+ "Invalid expression \"%s\" in file %s",
+ expr, r->filename);
rputs(error, r);
goto RETURN;
}
break;
}
- if (current == (struct parse_node*)NULL) {
+ if (current == (struct parse_node *) NULL) {
new->left = root;
new->left->parent = new;
- new->parent = (struct parse_node*)NULL;
+ new->parent = (struct parse_node *) NULL;
root = new;
- } else {
+ }
+ else {
new->left = current->right;
current->right = new;
new->parent = current;
}
current = new;
break;
- default:
+ default:
break;
}
}
/* Evaluate Parse Tree */
current = root;
- while (current != (struct parse_node *)NULL) {
- switch(current->token.type) {
- case token_string:
+ while (current != (struct parse_node *) NULL) {
+ switch (current->token.type) {
+ case token_string:
#ifdef DEBUG_INCLUDE
-rputs(" Evaluate string\n", r);
+ rputs(" Evaluate string\n", r);
#endif
parse_string(r, current->token.value, buffer, MAX_STRING_LEN, 0);
strncpy(current->token.value, buffer, MAX_STRING_LEN - 1);
@@ -1433,52 +1454,52 @@
current = current->parent;
break;
- case token_and:
- case token_or:
+ case token_and:
+ case token_or:
#ifdef DEBUG_INCLUDE
-rputs(" Evaluate and/or\n", r);
+ rputs(" Evaluate and/or\n", r);
#endif
- if (current->left == (struct parse_node*)NULL ||
- current->right == (struct parse_node*)NULL) {
+ if (current->left == (struct parse_node *) NULL ||
+ current->right == (struct parse_node *) NULL) {
aplog_error(APLOG_MARK, APLOG_ERR, r->server,
- "Invalid expression \"%s\" in file %s",
- expr, r->filename);
+ "Invalid expression \"%s\" in file %s",
+ expr, r->filename);
rputs(error, r);
goto RETURN;
}
if (!current->left->done) {
- switch(current->left->token.type) {
- case token_string:
+ switch (current->left->token.type) {
+ case token_string:
parse_string(r, current->left->token.value,
- buffer, MAX_STRING_LEN, 0);
+ buffer, MAX_STRING_LEN, 0);
strncpy(current->left->token.value, buffer,
MAX_STRING_LEN - 1);
current->left->token.value[MAX_STRING_LEN - 1] = '\0';
current->left->done = 1;
break;
- default:
+ default:
current = current->left;
continue;
}
}
if (!current->right->done) {
- switch(current->right->token.type) {
- case token_string:
+ switch (current->right->token.type) {
+ case token_string:
parse_string(r, current->right->token.value,
- buffer, MAX_STRING_LEN, 0);
+ buffer, MAX_STRING_LEN, 0);
strncpy(current->right->token.value, buffer,
MAX_STRING_LEN - 1);
current->right->token.value[MAX_STRING_LEN - 1] = '\0';
current->right->done = 1;
break;
- default:
+ default:
current = current->right;
continue;
}
}
#ifdef DEBUG_INCLUDE
-rvputs(r, " Left: ", current->left->value ? "1" : "0", "\n", NULL);
-rvputs(r, " Right: ", current->right->value ? "1" : "0", "\n", NULL);
+ rvputs(r, " Left: ", current->left->value ? "1" : "0", "\n", NULL);
+ rvputs(r, " Right: ", current->right->value ? "1" : "0", "\n", NULL);
#endif
if (current->token.type == token_and)
current->value =
@@ -1487,24 +1508,24 @@
current->value =
current->left->value || current->right->value;
#ifdef DEBUG_INCLUDE
-rvputs(r, " Returning ", current->value ? "1" : "0", "\n", NULL);
+ rvputs(r, " Returning ", current->value ? "1" : "0", "\n", NULL);
#endif
current->done = 1;
current = current->parent;
break;
- case token_eq:
- case token_ne:
+ case token_eq:
+ case token_ne:
#ifdef DEBUG_INCLUDE
-rputs(" Evaluate eq/ne\n", r);
+ rputs(" Evaluate eq/ne\n", r);
#endif
- if ((current->left == (struct parse_node*)NULL) ||
- (current->right == (struct parse_node*)NULL) ||
- (current->left->token.type != token_string) ||
- (current->right->token.type != token_string)) {
+ if ((current->left == (struct parse_node *) NULL) ||
+ (current->right == (struct parse_node *) NULL) ||
+ (current->left->token.type != token_string) ||
+ (current->right->token.type != token_string)) {
aplog_error(APLOG_MARK, APLOG_ERR, r->server,
- "Invalid expression \"%s\" in file %s",
- expr, r->filename);
+ "Invalid expression \"%s\" in file %s",
+ expr, r->filename);
rputs(error, r);
goto RETURN;
}
@@ -1522,52 +1543,52 @@
if (current->right->token.value[len - 1] == '/') {
current->right->token.value[len - 1] = '\0';
}
- else {
+ else {
aplog_error(APLOG_MARK, APLOG_ERR, r->server,
- "Invalid rexp \"%s\" in file %s",
- current->right->token.value, r->filename);
+ "Invalid rexp \"%s\" in file %s",
+ current->right->token.value, r->filename);
rputs(error, r);
goto RETURN;
}
#ifdef DEBUG_INCLUDE
-rvputs(r, " Re Compare (", current->left->token.value,
- ") with /", ¤t->right->token.value[1], "/\n", NULL);
+ rvputs(r, " Re Compare (", current->left->token.value,
+ ") with /", ¤t->right->token.value[1], "/\n", NULL);
#endif
current->value =
re_check(r, current->left->token.value,
- ¤t->right->token.value[1]);
+ ¤t->right->token.value[1]);
}
- else {
+ else {
#ifdef DEBUG_INCLUDE
-rvputs(r, " Compare (", current->left->token.value,
- ") with (", current->right->token.value, ")\n", NULL);
+ rvputs(r, " Compare (", current->left->token.value,
+ ") with (", current->right->token.value, ")\n", NULL);
#endif
current->value =
- (strcmp(current->left->token.value,
- current->right->token.value) == 0);
+ (strcmp(current->left->token.value,
+ current->right->token.value) == 0);
}
if (current->token.type == token_ne)
current->value = !current->value;
#ifdef DEBUG_INCLUDE
-rvputs(r, " Returning ", current->value ? "1" : "0", "\n", NULL);
+ rvputs(r, " Returning ", current->value ? "1" : "0", "\n", NULL);
#endif
current->done = 1;
current = current->parent;
break;
- case token_ge:
- case token_gt:
- case token_le:
- case token_lt:
-#ifdef DEBUG_INCLUDE
-rputs(" Evaluate ge/gt/le/lt\n", r);
-#endif
- if ((current->left == (struct parse_node*)NULL) ||
- (current->right == (struct parse_node*)NULL) ||
- (current->left->token.type != token_string) ||
- (current->right->token.type != token_string)) {
+ case token_ge:
+ case token_gt:
+ case token_le:
+ case token_lt:
+#ifdef DEBUG_INCLUDE
+ rputs(" Evaluate ge/gt/le/lt\n", r);
+#endif
+ if ((current->left == (struct parse_node *) NULL) ||
+ (current->right == (struct parse_node *) NULL) ||
+ (current->left->token.type != token_string) ||
+ (current->right->token.type != token_string)) {
aplog_error(APLOG_MARK, APLOG_ERR, r->server,
- "Invalid expression \"%s\" in file %s",
- expr, r->filename);
+ "Invalid expression \"%s\" in file %s",
+ expr, r->filename);
rputs(error, r);
goto RETURN;
}
@@ -1578,12 +1599,12 @@
buffer, MAX_STRING_LEN, 0);
strncpy(current->right->token.value, buffer, MAX_STRING_LEN - 1);
#ifdef DEBUG_INCLUDE
-rvputs(r, " Compare (", current->left->token.value,
- ") with (", current->right->token.value, ")\n", NULL);
+ rvputs(r, " Compare (", current->left->token.value,
+ ") with (", current->right->token.value, ")\n", NULL);
#endif
current->value =
- strcmp(current->left->token.value,
- current->right->token.value);
+ strcmp(current->left->token.value,
+ current->right->token.value);
if (current->token.type == token_ge)
current->value = current->value >= 0;
else if (current->token.type == token_gt)
@@ -1592,79 +1613,80 @@
current->value = current->value <= 0;
else if (current->token.type == token_lt)
current->value = current->value < 0;
- else current->value = 0; /* Don't return -1 if unknown token */
+ else
+ current->value = 0; /* Don't return -1 if unknown token */
#ifdef DEBUG_INCLUDE
-rvputs(r, " Returning ", current->value ? "1" : "0", "\n", NULL);
+ rvputs(r, " Returning ", current->value ? "1" : "0", "\n", NULL);
#endif
current->done = 1;
current = current->parent;
break;
- case token_not:
- if (current->right != (struct parse_node *)NULL) {
+ case token_not:
+ if (current->right != (struct parse_node *) NULL) {
if (!current->right->done) {
current = current->right;
continue;
}
current->value = !current->right->value;
}
- else {
+ else {
current->value = 0;
}
#ifdef DEBUG_INCLUDE
-rvputs(r, " Evaluate !: ", current->value ? "1" : "0", "\n", NULL);
+ rvputs(r, " Evaluate !: ", current->value ? "1" : "0", "\n", NULL);
#endif
current->done = 1;
current = current->parent;
break;
- case token_group:
- if (current->right != (struct parse_node *)NULL) {
+ case token_group:
+ if (current->right != (struct parse_node *) NULL) {
if (!current->right->done) {
current = current->right;
continue;
}
current->value = current->right->value;
}
- else {
+ else {
current->value = 1;
}
#ifdef DEBUG_INCLUDE
-rvputs(r, " Evaluate (): ", current->value ? "1" : "0", "\n", NULL);
+ rvputs(r, " Evaluate (): ", current->value ? "1" : "0", "\n", NULL);
#endif
current->done = 1;
current = current->parent;
break;
- case token_lbrace:
+ case token_lbrace:
aplog_error(APLOG_MARK, APLOG_ERR, r->server,
- "Unmatched '(' in \"%s\" in file %s",
- expr, r->filename);
+ "Unmatched '(' in \"%s\" in file %s",
+ expr, r->filename);
rputs(error, r);
goto RETURN;
- case token_rbrace:
+ case token_rbrace:
aplog_error(APLOG_MARK, APLOG_ERR, r->server,
- "Unmatched ')' in \"%s\" in file %s\n",
- expr, r->filename);
+ "Unmatched ')' in \"%s\" in file %s\n",
+ expr, r->filename);
rputs(error, r);
goto RETURN;
- default:
+ default:
aplog_error(APLOG_MARK, APLOG_ERR, r->server, "bad token type");
rputs(error, r);
goto RETURN;
}
}
- retval = (root == (struct parse_node *)NULL) ? 0 : root->value;
-RETURN:
+ retval = (root == (struct parse_node *) NULL) ? 0 : root->value;
+ RETURN:
destroy_pool(expr_pool);
return (retval);
-}
+}
-static int handle_if (FILE *in, request_rec *r, char *error,
- int *conditional_status, int *printing)
+static int handle_if(FILE *in, request_rec *r, char *error,
+ int *conditional_status, int *printing)
{
char tag[MAX_STRING_LEN];
char *tag_val = '\0';
@@ -1677,27 +1699,28 @@
else if (!strcmp(tag, "done")) {
*printing = *conditional_status = parse_expr(r, expr, error);
#ifdef DEBUG_INCLUDE
- rvputs(r, "**** if conditional_status=\"",
- *conditional_status ? "1" : "0", "\"\n", NULL);
+ rvputs(r, "**** if conditional_status=\"",
+ *conditional_status ? "1" : "0", "\"\n", NULL);
#endif
return 0;
- } else if (!strcmp(tag, "expr")) {
+ }
+ else if (!strcmp(tag, "expr")) {
expr = tag_val;
#ifdef DEBUG_INCLUDE
- rvputs(r, "**** if expr=\"", expr, "\"\n", NULL);
+ rvputs(r, "**** if expr=\"", expr, "\"\n", NULL);
#endif
}
- else {
+ else {
aplog_error(APLOG_MARK, APLOG_ERR, r->server,
- "unknown parameter \"%s\" to tag if in %s",
- tag, r->filename);
+ "unknown parameter \"%s\" to tag if in %s",
+ tag, r->filename);
rputs(error, r);
}
}
-}
+}
-static int handle_elif (FILE *in, request_rec *r, char *error,
- int *conditional_status, int *printing)
+static int handle_elif(FILE *in, request_rec *r, char *error,
+ int *conditional_status, int *printing)
{
char tag[MAX_STRING_LEN];
char *tag_val = '\0';
@@ -1709,43 +1732,44 @@
return 1;
else if (!strcmp(tag, "done")) {
#ifdef DEBUG_INCLUDE
-rvputs(r, "**** elif conditional_status=\"", *conditional_status ? "1" : "0", "\"\n", NULL);
+ rvputs(r, "**** elif conditional_status=\"", *conditional_status ? "1" : "0", "\"\n", NULL);
#endif
if (*conditional_status) {
*printing = 0;
- return(0);
+ return (0);
}
*printing = *conditional_status = parse_expr(r, expr, error);
#ifdef DEBUG_INCLUDE
-rvputs(r, "**** elif conditional_status=\"", *conditional_status ? "1" : "0", "\"\n", NULL);
+ rvputs(r, "**** elif conditional_status=\"", *conditional_status ? "1" : "0", "\"\n", NULL);
#endif
return 0;
- } else if (!strcmp(tag, "expr")) {
+ }
+ else if (!strcmp(tag, "expr")) {
expr = tag_val;
#ifdef DEBUG_INCLUDE
-rvputs(r, "**** if expr=\"", expr, "\"\n", NULL);
+ rvputs(r, "**** if expr=\"", expr, "\"\n", NULL);
#endif
}
- else {
+ else {
aplog_error(APLOG_MARK, APLOG_ERR, r->server,
- "unknown parameter \"%s\" to tag if in %s",
- tag, r->filename);
+ "unknown parameter \"%s\" to tag if in %s",
+ tag, r->filename);
rputs(error, r);
}
}
}
-static int handle_else (FILE *in, request_rec *r, char *error,
- int *conditional_status, int *printing)
+static int handle_else(FILE *in, request_rec *r, char *error,
+ int *conditional_status, int *printing)
{
char tag[MAX_STRING_LEN];
char *tag_val;
if (!(tag_val = get_tag(r->pool, in, tag, MAX_STRING_LEN, 1)))
- return 1;
+ return 1;
else if (!strcmp(tag, "done")) {
#ifdef DEBUG_INCLUDE
-rvputs(r, "**** else conditional_status=\"", *conditional_status ? "1" : "0", "\"\n", NULL);
+ rvputs(r, "**** else conditional_status=\"", *conditional_status ? "1" : "0", "\"\n", NULL);
#endif
*printing = !(*conditional_status);
*conditional_status = 1;
@@ -1753,24 +1777,25 @@
}
else {
aplog_error(APLOG_MARK, APLOG_ERR, r->server,
- "else directive does not take tags");
+ "else directive does not take tags");
if (*printing)
rputs(error, r);
return -1;
}
-}
+}
-static int handle_endif (FILE *in, request_rec *r, char *error,
- int *conditional_status, int *printing)
+static int handle_endif(FILE *in, request_rec *r, char *error,
+ int *conditional_status, int *printing)
{
char tag[MAX_STRING_LEN];
char *tag_val;
if (!(tag_val = get_tag(r->pool, in, tag, MAX_STRING_LEN, 1))) {
return 1;
- } else if (!strcmp(tag, "done")) {
+ }
+ else if (!strcmp(tag, "done")) {
#ifdef DEBUG_INCLUDE
-rvputs(r, "**** endif conditional_status=\"", *conditional_status ? "1" : "0", "\"\n", NULL);
+ rvputs(r, "**** endif conditional_status=\"", *conditional_status ? "1" : "0", "\"\n", NULL);
#endif
*printing = 1;
*conditional_status = 1;
@@ -1778,41 +1803,42 @@
}
else {
aplog_error(APLOG_MARK, APLOG_ERR, r->server,
- "endif directive does not take tags");
+ "endif directive does not take tags");
rputs(error, r);
return -1;
}
-}
+}
-static int handle_set (FILE *in, request_rec *r, char *error)
+static int handle_set(FILE *in, request_rec *r, char *error)
{
char tag[MAX_STRING_LEN];
char parsed_string[MAX_STRING_LEN];
char *tag_val;
char *var;
- var = (char *)NULL;
+ var = (char *) NULL;
while (1) {
if (!(tag_val = get_tag(r->pool, in, tag, MAX_STRING_LEN, 1)))
- return 1;
+ return 1;
else if (!strcmp(tag, "done"))
return 0;
else if (!strcmp(tag, "var")) {
var = tag_val;
- } else if (!strcmp(tag, "value")) {
- if (var == (char *)NULL) {
+ }
+ else if (!strcmp(tag, "value")) {
+ if (var == (char *) NULL) {
aplog_error(APLOG_MARK, APLOG_ERR, r->server,
- "variable must precede value in set directive");
+ "variable must precede value in set directive");
rputs(error, r);
return -1;
- }
+ }
parse_string(r, tag_val, parsed_string, MAX_STRING_LEN, 0);
- table_set (r->subprocess_env, var, parsed_string);
+ table_set(r->subprocess_env, var, parsed_string);
}
}
-}
+}
-static int handle_printenv (FILE *in, request_rec *r, char *error)
+static int handle_printenv(FILE *in, request_rec *r, char *error)
{
char tag[MAX_STRING_LEN];
char *tag_val;
@@ -1820,19 +1846,19 @@
int i;
if (!(tag_val = get_tag(r->pool, in, tag, MAX_STRING_LEN, 1)))
- return 1;
+ return 1;
else if (!strcmp(tag, "done")) {
- for (i = 0; i < r->subprocess_env->nelts; ++i)
- rvputs(r, elts[i].key, "=", elts[i].val, "\n", NULL);
- return 0;
+ for (i = 0; i < r->subprocess_env->nelts; ++i)
+ rvputs(r, elts[i].key, "=", elts[i].val, "\n", NULL);
+ return 0;
}
else {
aplog_error(APLOG_MARK, APLOG_ERR, r->server,
- "printenv directive does not take tags");
+ "printenv directive does not take tags");
rputs(error, r);
return -1;
}
-}
+}
@@ -1840,11 +1866,11 @@
/* This is a stub which parses a file descriptor. */
-static void send_parsed_content (FILE *f, request_rec *r)
+static void send_parsed_content(FILE *f, request_rec *r)
{
char directive[MAX_STRING_LEN], error[MAX_STRING_LEN];
char timefmt[MAX_STRING_LEN];
- int noexec = allow_options (r) & OPT_INCNOEXEC;
+ int noexec = allow_options(r) & OPT_INCNOEXEC;
int ret, sizefmt;
int if_nesting;
int printing;
@@ -1860,57 +1886,64 @@
printing = conditional_status = 1;
if_nesting = 0;
- chdir_file (r->filename);
- if (r->args) { /* add QUERY stuff to env cause it ain't yet */
- char *arg_copy = pstrdup (r->pool, r->args);
-
- table_set (r->subprocess_env, "QUERY_STRING", r->args);
- unescape_url (arg_copy);
- table_set (r->subprocess_env, "QUERY_STRING_UNESCAPED",
- escape_shell_cmd (r->pool, arg_copy));
+ chdir_file(r->filename);
+ if (r->args) { /* add QUERY stuff to env cause it ain't yet */
+ char *arg_copy = pstrdup(r->pool, r->args);
+
+ table_set(r->subprocess_env, "QUERY_STRING", r->args);
+ unescape_url(arg_copy);
+ table_set(r->subprocess_env, "QUERY_STRING_UNESCAPED",
+ escape_shell_cmd(r->pool, arg_copy));
}
while (1) {
if (!find_string(f, STARTING_SEQUENCE, r, printing)) {
if (get_directive(f, directive, r->pool))
- return;
+ return;
if (!strcmp(directive, "if")) {
if (!printing) {
if_nesting++;
- } else {
+ }
+ else {
ret = handle_if(f, r, error, &conditional_status, &printing);
if_nesting = 0;
}
continue;
- } else if (!strcmp(directive, "else")) {
+ }
+ else if (!strcmp(directive, "else")) {
if (!if_nesting)
ret = handle_else(f, r, error, &conditional_status, &printing);
continue;
- } else if (!strcmp(directive, "elif")) {
+ }
+ else if (!strcmp(directive, "elif")) {
if (!if_nesting)
ret = handle_elif(f, r, error, &conditional_status, &printing);
continue;
- } else if (!strcmp(directive, "endif")) {
+ }
+ else if (!strcmp(directive, "endif")) {
if (!if_nesting) {
ret = handle_endif(f, r, error, &conditional_status, &printing);
- } else {
+ }
+ else {
if_nesting--;
}
continue;
- }
+ }
if (!printing)
continue;
if (!strcmp(directive, "exec")) {
if (noexec) {
aplog_error(APLOG_MARK, APLOG_ERR, r->server,
- "httpd: exec used but not allowed in %s",
- r->filename);
+ "httpd: exec used but not allowed in %s",
+ r->filename);
if (printing)
rputs(error, r);
ret = find_string(f, ENDING_SEQUENCE, r, 0);
- } else
+ }
+ else
ret = handle_exec(f, r, error);
- } else if (!strcmp(directive, "config"))
+ }
+ else if (!strcmp(directive, "config"))
ret = handle_config(f, r, error, timefmt, &sizefmt);
else if (!strcmp(directive, "set"))
ret = handle_set(f, r, error);
@@ -1925,24 +1958,25 @@
else if (!strcmp(directive, "printenv"))
ret = handle_printenv(f, r, error);
#ifdef USE_PERL_SSI
- else if (!strcmp(directive, "perl"))
+ else if (!strcmp(directive, "perl"))
ret = handle_perl(f, r, error);
#endif
else {
aplog_error(APLOG_MARK, APLOG_ERR, r->server,
- "httpd: unknown directive \"%s\" in parsed doc %s",
- directive, r->filename);
+ "httpd: unknown directive \"%s\" in parsed doc %s",
+ directive, r->filename);
if (printing)
rputs(error, r);
ret = find_string(f, ENDING_SEQUENCE, r, 0);
}
if (ret) {
aplog_error(APLOG_MARK, APLOG_ERR, r->server,
- "httpd: premature EOF in parsed file %s",
- r->filename);
+ "httpd: premature EOF in parsed file %s",
+ r->filename);
return;
}
- } else
+ }
+ else
return;
}
}
@@ -1954,57 +1988,60 @@
*/
module includes_module;
-enum xbithack { xbithack_off, xbithack_on, xbithack_full };
+enum xbithack {
+ xbithack_off, xbithack_on, xbithack_full
+};
-#ifdef XBITHACK
+#ifdef XBITHACK
#define DEFAULT_XBITHACK xbithack_full
#else
#define DEFAULT_XBITHACK xbithack_off
#endif
-static void *create_includes_dir_config (pool *p, char *dummy)
+static void *create_includes_dir_config(pool *p, char *dummy)
{
- enum xbithack *result = (enum xbithack*)palloc(p, sizeof (enum xbithack));
+ enum xbithack *result = (enum xbithack *) palloc(p, sizeof(enum xbithack));
*result = DEFAULT_XBITHACK;
return result;
}
-static const char *set_xbithack (cmd_parms *cmd, void *xbp, char *arg)
+static const char *set_xbithack(cmd_parms *cmd, void *xbp, char *arg)
{
- enum xbithack *state = (enum xbithack *)xbp;
+ enum xbithack *state = (enum xbithack *) xbp;
- if (!strcasecmp (arg, "off"))
+ if (!strcasecmp(arg, "off"))
*state = xbithack_off;
- else if (!strcasecmp (arg, "on"))
+ else if (!strcasecmp(arg, "on"))
*state = xbithack_on;
- else if (!strcasecmp (arg, "full"))
+ else if (!strcasecmp(arg, "full"))
*state = xbithack_full;
- else return "XBitHack must be set to Off, On, or Full";
+ else
+ return "XBitHack must be set to Off, On, or Full";
- return NULL;
+ return NULL;
}
-static int send_parsed_file (request_rec *r)
+static int send_parsed_file(request_rec *r)
{
FILE *f;
enum xbithack *state =
- (enum xbithack *)get_module_config(r->per_dir_config, &includes_module);
+ (enum xbithack *) get_module_config(r->per_dir_config, &includes_module);
int errstatus;
- if (!(allow_options (r) & OPT_INCLUDES))
+ if (!(allow_options(r) & OPT_INCLUDES))
return DECLINED;
if (r->method_number != M_GET)
return DECLINED;
if (r->finfo.st_mode == 0) {
aplog_error(APLOG_MARK, APLOG_ERR, r->server, "File does not exist: %s",
- r->path_info ?
- pstrcat(r->pool, r->filename, r->path_info, NULL) : r->filename);
+ r->path_info ?
+ pstrcat(r->pool, r->filename, r->path_info, NULL) : r->filename);
return NOT_FOUND;
}
if (!(f = pfopen(r->pool, r->filename, "r"))) {
aplog_error(APLOG_MARK, APLOG_ERR, r->server,
- "file permissions deny server access: %s", r->filename);
+ "file permissions deny server access: %s", r->filename);
return FORBIDDEN;
}
@@ -2013,21 +2050,21 @@
/* OS/2 dosen't support Groups. */
&& (r->finfo.st_mode & S_IXGRP)
#endif
- ) {
- update_mtime(r, r->finfo.st_mtime);
- set_last_modified(r);
+ ) {
+ update_mtime(r, r->finfo.st_mtime);
+ set_last_modified(r);
}
if ((errstatus = meets_conditions(r)) != OK) {
- return errstatus;
+ return errstatus;
}
send_http_header(r);
if (r->header_only) {
- pfclose (r->pool, f);
+ pfclose(r->pool, f);
return OK;
}
-
+
if (r->main) {
/* Kludge --- for nested includes, we want to keep the
* subprocess environment of the base document (for compatibility);
@@ -2037,76 +2074,80 @@
*/
r->subprocess_env = r->main->subprocess_env;
r->finfo.st_mtime = r->main->finfo.st_mtime;
- } else {
- add_common_vars (r);
+ }
+ else {
+ add_common_vars(r);
add_cgi_vars(r);
- add_include_vars (r, DEFAULT_TIME_FORMAT);
+ add_include_vars(r, DEFAULT_TIME_FORMAT);
}
hard_timeout("send SSI", r);
- send_parsed_content (f, r);
-
- kill_timeout (r);
+ send_parsed_content(f, r);
+
+ kill_timeout(r);
return OK;
}
-static int send_shtml_file (request_rec *r)
+static int send_shtml_file(request_rec *r)
{
r->content_type = "text/html";
return send_parsed_file(r);
}
-static int xbithack_handler (request_rec *r)
+static int xbithack_handler(request_rec *r)
{
#if defined(__EMX__) || defined(WIN32)
/* OS/2 dosen't currently support the xbithack. This is being worked on. */
return DECLINED;
#else
enum xbithack *state;
-
+
if (!(r->finfo.st_mode & S_IXUSR))
return DECLINED;
- state = (enum xbithack *)get_module_config(r->per_dir_config,
- &includes_module);
-
+ state = (enum xbithack *) get_module_config(r->per_dir_config,
+ &includes_module);
+
if (*state == xbithack_off)
return DECLINED;
- return send_parsed_file (r);
+ return send_parsed_file(r);
#endif
}
-static command_rec includes_cmds[] = {
- { "XBitHack", set_xbithack, NULL, OR_OPTIONS, TAKE1, "Off, On, or Full" },
- { NULL }
+static command_rec includes_cmds[] =
+{
+ {"XBitHack", set_xbithack, NULL, OR_OPTIONS, TAKE1, "Off, On, or Full"},
+ {NULL}
};
-static handler_rec includes_handlers[] = {
- { INCLUDES_MAGIC_TYPE, send_shtml_file },
- { INCLUDES_MAGIC_TYPE3, send_shtml_file },
- { "server-parsed", send_parsed_file },
- { "text/html", xbithack_handler },
- { NULL }
+static handler_rec includes_handlers[] =
+{
+ {INCLUDES_MAGIC_TYPE, send_shtml_file},
+ {INCLUDES_MAGIC_TYPE3, send_shtml_file},
+ {"server-parsed", send_parsed_file},
+ {"text/html", xbithack_handler},
+ {NULL}
};
-module includes_module = {
- STANDARD_MODULE_STUFF,
- NULL, /* initializer */
- create_includes_dir_config, /* dir config creater */
- NULL, /* dir merger --- default is to override */
- NULL, /* server config */
- NULL, /* merge server config */
- includes_cmds, /* command table */
- includes_handlers, /* handlers */
- NULL, /* filename translation */
- NULL, /* check_user_id */
- NULL, /* check auth */
- NULL, /* check access */
- NULL, /* type_checker */
- NULL, /* fixups */
- NULL, /* logger */
- NULL, /* header parser */
- NULL, /* child_init */
- NULL, /* child_exit */
- NULL /* post read-request */
+module includes_module =
+{
+ STANDARD_MODULE_STUFF,
+ NULL, /* initializer */
+ create_includes_dir_config, /* dir config creater */
+ NULL, /* dir merger --- default is to override */
+ NULL, /* server config */
+ NULL, /* merge server config */
+ includes_cmds, /* command table */
+ includes_handlers, /* handlers */
+ NULL, /* filename translation */
+ NULL, /* check_user_id */
+ NULL, /* check auth */
+ NULL, /* check access */
+ NULL, /* type_checker */
+ NULL, /* fixups */
+ NULL, /* logger */
+ NULL, /* header parser */
+ NULL, /* child_init */
+ NULL, /* child_exit */
+ NULL /* post read-request */
};
1.24 +162 -150 apachen/src/modules/standard/mod_mime.c
Index: mod_mime.c
===================================================================
RCS file: /export/home/cvs/apachen/src/modules/standard/mod_mime.c,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -r1.23 -r1.24
--- mod_mime.c 1997/08/18 13:12:15 1.23
+++ mod_mime.c 1997/09/18 18:49:39 1.24
@@ -64,48 +64,48 @@
#include "mod_mime.h"
typedef struct {
- table *forced_types; /* Additional AddTyped stuff */
- table *encoding_types; /* Added with AddEncoding... */
- table *language_types; /* Added with AddLanguage... */
- table *handlers; /* Added with AddHandler... */
+ table *forced_types; /* Additional AddTyped stuff */
+ table *encoding_types; /* Added with AddEncoding... */
+ table *language_types; /* Added with AddLanguage... */
+ table *handlers; /* Added with AddHandler... */
- char *type; /* Type forced with ForceType */
- char *handler; /* Handler forced with SetHandler */
+ char *type; /* Type forced with ForceType */
+ char *handler; /* Handler forced with SetHandler */
} mime_dir_config;
module MODULE_VAR_EXPORT mime_module;
-static void *create_mime_dir_config (pool *p, char *dummy)
+static void *create_mime_dir_config(pool *p, char *dummy)
{
mime_dir_config *new =
- (mime_dir_config *) palloc (p, sizeof(mime_dir_config));
+ (mime_dir_config *) palloc(p, sizeof(mime_dir_config));
- new->forced_types = make_table (p, 4);
- new->encoding_types = make_table (p, 4);
- new->language_types = make_table (p, 4);
- new->handlers = make_table (p, 4);
+ new->forced_types = make_table(p, 4);
+ new->encoding_types = make_table(p, 4);
+ new->language_types = make_table(p, 4);
+ new->handlers = make_table(p, 4);
new->type = NULL;
new->handler = NULL;
-
+
return new;
}
-static void *merge_mime_dir_configs (pool *p, void *basev, void *addv)
+static void *merge_mime_dir_configs(pool *p, void *basev, void *addv)
{
- mime_dir_config *base = (mime_dir_config *)basev;
- mime_dir_config *add = (mime_dir_config *)addv;
+ mime_dir_config *base = (mime_dir_config *) basev;
+ mime_dir_config *add = (mime_dir_config *) addv;
mime_dir_config *new =
- (mime_dir_config *)palloc (p, sizeof(mime_dir_config));
+ (mime_dir_config *) palloc(p, sizeof(mime_dir_config));
- new->forced_types = overlay_tables (p, add->forced_types,
- base->forced_types);
- new->encoding_types = overlay_tables (p, add->encoding_types,
- base->encoding_types);
- new->language_types = overlay_tables (p, add->language_types,
- base->language_types);
- new->handlers = overlay_tables (p, add->handlers,
- base->handlers);
+ new->forced_types = overlay_tables(p, add->forced_types,
+ base->forced_types);
+ new->encoding_types = overlay_tables(p, add->encoding_types,
+ base->encoding_types);
+ new->language_types = overlay_tables(p, add->language_types,
+ base->language_types);
+ new->handlers = overlay_tables(p, add->handlers,
+ base->handlers);
new->type = add->type ? add->type : base->type;
new->handler = add->handler ? add->handler : base->handler;
@@ -113,34 +113,38 @@
return new;
}
-static const char *add_type(cmd_parms *cmd, mime_dir_config *m, char *ct, char *ext)
+static const char *add_type(cmd_parms *cmd, mime_dir_config * m, char *ct, char *ext)
{
- if (*ext == '.') ++ext;
- table_set (m->forced_types, ext, ct);
+ if (*ext == '.')
+ ++ext;
+ table_set(m->forced_types, ext, ct);
return NULL;
}
-static const char *add_encoding(cmd_parms *cmd, mime_dir_config *m, char *enc,
- char *ext)
+static const char *add_encoding(cmd_parms *cmd, mime_dir_config * m, char *enc,
+ char *ext)
{
- if (*ext == '.') ++ext;
- table_set (m->encoding_types, ext, enc);
+ if (*ext == '.')
+ ++ext;
+ table_set(m->encoding_types, ext, enc);
return NULL;
}
-static const char *add_language(cmd_parms *cmd, mime_dir_config *m, char *lang,
- char *ext)
+static const char *add_language(cmd_parms *cmd, mime_dir_config * m, char *lang,
+ char *ext)
{
- if (*ext == '.') ++ext;
- table_set (m->language_types, ext, lang);
+ if (*ext == '.')
+ ++ext;
+ table_set(m->language_types, ext, lang);
return NULL;
}
-static const char *add_handler(cmd_parms *cmd, mime_dir_config *m, char *hdlr,
- char *ext)
+static const char *add_handler(cmd_parms *cmd, mime_dir_config * m, char *hdlr,
+ char *ext)
{
- if (*ext == '.') ++ext;
- table_set (m->handlers, ext, hdlr);
+ if (*ext == '.')
+ ++ext;
+ table_set(m->handlers, ext, hdlr);
return NULL;
}
@@ -148,29 +152,30 @@
* the name of its config file, so...
*/
-static const char *set_types_config (cmd_parms *cmd, void *dummy, char *arg)
+static const char *set_types_config(cmd_parms *cmd, void *dummy, char *arg)
{
- set_module_config (cmd->server->module_config, &mime_module,
- pstrdup (cmd->pool, arg));
+ set_module_config(cmd->server->module_config, &mime_module,
+ pstrdup(cmd->pool, arg));
return NULL;
}
-static command_rec mime_cmds[] = {
-{ "AddType", add_type, NULL, OR_FILEINFO, ITERATE2,
- "a mime type followed by one or more file extensions" },
-{ "AddEncoding", add_encoding, NULL, OR_FILEINFO, ITERATE2,
- "an encoding (e.g., gzip), followed by one or more file extensions" },
-{ "AddLanguage", add_language, NULL, OR_FILEINFO, ITERATE2,
- "a language (e.g., fr), followed by one or more file extensions" },
-{ "AddHandler", add_handler, NULL, OR_FILEINFO, ITERATE2,
- "a handler name followed by one or more file extensions" },
-{ "ForceType", set_string_slot, (void*)XtOffsetOf(mime_dir_config, type),
- OR_FILEINFO, TAKE1, "a media type" },
-{ "SetHandler", set_string_slot, (void*)XtOffsetOf(mime_dir_config, handler),
- OR_FILEINFO, TAKE1, "a handler name" },
-{ "TypesConfig", set_types_config, NULL, RSRC_CONF, TAKE1,
- "the MIME types config file" },
-{ NULL }
+static command_rec mime_cmds[] =
+{
+ {"AddType", add_type, NULL, OR_FILEINFO, ITERATE2,
+ "a mime type followed by one or more file extensions"},
+ {"AddEncoding", add_encoding, NULL, OR_FILEINFO, ITERATE2,
+ "an encoding (e.g., gzip), followed by one or more file extensions"},
+ {"AddLanguage", add_language, NULL, OR_FILEINFO, ITERATE2,
+ "a language (e.g., fr), followed by one or more file extensions"},
+ {"AddHandler", add_handler, NULL, OR_FILEINFO, ITERATE2,
+ "a handler name followed by one or more file extensions"},
+ {"ForceType", set_string_slot, (void *) XtOffsetOf(mime_dir_config, type),
+ OR_FILEINFO, TAKE1, "a media type"},
+ {"SetHandler", set_string_slot, (void *) XtOffsetOf(mime_dir_config, handler),
+ OR_FILEINFO, TAKE1, "a handler name"},
+ {"TypesConfig", set_types_config, NULL, RSRC_CONF, TAKE1,
+ "the MIME types config file"},
+ {NULL}
};
/* Hash table --- only one of these per daemon; virtual hosts can
@@ -182,37 +187,39 @@
static table *hash_buckets[MIME_HASHSIZE];
-static void init_mime (server_rec *s, pool *p)
+static void init_mime(server_rec *s, pool *p)
{
FILE *f;
char l[MAX_STRING_LEN];
int x;
- char *types_confname = get_module_config (s->module_config, &mime_module);
+ char *types_confname = get_module_config(s->module_config, &mime_module);
- if (!types_confname) types_confname = TYPES_CONFIG_FILE;
+ if (!types_confname)
+ types_confname = TYPES_CONFIG_FILE;
- types_confname = server_root_relative (p, types_confname);
+ types_confname = server_root_relative(p, types_confname);
- if(!(f = fopen(types_confname,"r"))) {
+ if (!(f = fopen(types_confname, "r"))) {
perror("fopen");
- fprintf(stderr,"httpd: could not open mime types file %s\n",
+ fprintf(stderr, "httpd: could not open mime types file %s\n",
types_confname);
exit(1);
}
- for(x=0;x<27;x++)
- hash_buckets[x] = make_table (p, 10);
+ for (x = 0; x < 27; x++)
+ hash_buckets[x] = make_table(p, 10);
- while(!(cfg_getline(l,MAX_STRING_LEN,f))) {
+ while (!(cfg_getline(l, MAX_STRING_LEN, f))) {
const char *ll = l, *ct;
-
- if(l[0] == '#') continue;
- ct = getword_conf (p, &ll);
-
- while(ll[0]) {
- char *ext = getword_conf (p, &ll);
- str_tolower (ext); /* ??? */
- table_set (hash_buckets[hash(ext[0])], ext, ct);
+
+ if (l[0] == '#')
+ continue;
+ ct = getword_conf(p, &ll);
+
+ while (ll[0]) {
+ char *ext = getword_conf(p, &ll);
+ str_tolower(ext); /* ??? */
+ table_set(hash_buckets[hash(ext[0])], ext, ct);
}
}
fclose(f);
@@ -223,73 +230,74 @@
{
const char *fn = strrchr(r->filename, '/');
mime_dir_config *conf =
- (mime_dir_config *)get_module_config(r->per_dir_config, &mime_module);
+ (mime_dir_config *) get_module_config(r->per_dir_config, &mime_module);
char *ext, *type, *orighandler = r->handler;
if (S_ISDIR(r->finfo.st_mode)) {
r->content_type = DIR_MAGIC_TYPE;
- return OK;
+ return OK;
}
/* TM -- FIXME
- *
+
* if r->filename does not contain a '/', the following passes a null
* pointer to getword, causing a SEGV ..
*/
- if(fn == NULL) fn = r->filename;
+ if (fn == NULL)
+ fn = r->filename;
/* Parse filename extensions, which can be in any order */
while ((ext = getword(r->pool, &fn, '.')) && *ext) {
- int found = 0;
+ int found = 0;
+
+ /* Check for Content-Type */
+ if ((type = table_get(conf->forced_types, ext))
+ || (type = table_get(hash_buckets[hash(*ext)], ext))) {
+ r->content_type = type;
+ found = 1;
+ }
+
+ /* Check for Content-Language */
+ if ((type = table_get(conf->language_types, ext))) {
+ char **new;
+
+ r->content_language = type; /* back compat. only */
+ if (!r->content_languages)
+ r->content_languages = make_array(r->pool, 2, sizeof(char *));
+ new = (char **) push_array(r->content_languages);
+ *new = type;
+ found = 1;
+ }
- /* Check for Content-Type */
- if ((type = table_get (conf->forced_types, ext))
- || (type = table_get (hash_buckets[hash(*ext)], ext))) {
- r->content_type = type;
- found = 1;
- }
-
- /* Check for Content-Language */
- if ((type = table_get (conf->language_types, ext))) {
- char **new;
-
- r->content_language = type; /* back compat. only */
- if (!r->content_languages)
- r->content_languages = make_array (r->pool, 2, sizeof(char*));
- new = (char **)push_array (r->content_languages);
- *new = type;
- found = 1;
- }
-
- /* Check for Content-Encoding */
- if ((type = table_get (conf->encoding_types, ext))) {
- if (!r->content_encoding)
- r->content_encoding = type;
- else
- r->content_encoding = pstrcat(r->pool, r->content_encoding,
- ", ", type, NULL);
- found = 1;
- }
-
- /* Check for a special handler, but not for proxy request */
- if ((type = table_get (conf->handlers, ext)) && !r->proxyreq) {
- r->handler = type;
- found = 1;
- }
-
- /* This is to deal with cases such as foo.gif.bak, which we want
- * to not have a type. So if we find an unknown extension, we
- * zap the type/language/encoding and reset the handler
- */
-
- if (!found) {
- r->content_type = NULL;
- r->content_language = NULL;
- r->content_languages = NULL;
- r->content_encoding = NULL;
- r->handler = orighandler;
- }
+ /* Check for Content-Encoding */
+ if ((type = table_get(conf->encoding_types, ext))) {
+ if (!r->content_encoding)
+ r->content_encoding = type;
+ else
+ r->content_encoding = pstrcat(r->pool, r->content_encoding,
+ ", ", type, NULL);
+ found = 1;
+ }
+
+ /* Check for a special handler, but not for proxy request */
+ if ((type = table_get(conf->handlers, ext)) && !r->proxyreq) {
+ r->handler = type;
+ found = 1;
+ }
+
+ /* This is to deal with cases such as foo.gif.bak, which we want
+ * to not have a type. So if we find an unknown extension, we
+ * zap the type/language/encoding and reset the handler
+ */
+
+ if (!found) {
+ r->content_type = NULL;
+ r->content_language = NULL;
+ r->content_languages = NULL;
+ r->content_encoding = NULL;
+ r->handler = orighandler;
+ }
}
@@ -300,32 +308,36 @@
if (conf->handler && strcmp(conf->handler, "none"))
r->handler = pstrdup(r->pool, conf->handler);
- if (!r->content_type) return DECLINED;
+ if (!r->content_type)
+ return DECLINED;
return OK;
}
API_EXPORT(int) mime_find_ct(request_rec *r)
- { return find_ct(r); }
+{
+ return find_ct(r);
+}
-module MODULE_VAR_EXPORT mime_module = {
- STANDARD_MODULE_STUFF,
- init_mime, /* initializer */
- create_mime_dir_config,
- merge_mime_dir_configs,
- NULL, /* server config */
- NULL, /* merge server config */
- mime_cmds,
- NULL, /* handlers */
- NULL, /* filename translation */
- NULL, /* check_user_id */
- NULL, /* check auth */
- NULL, /* check access */
- find_ct, /* type_checker */
- NULL, /* fixups */
- NULL, /* logger */
- NULL, /* header parser */
- NULL, /* child_init */
- NULL, /* child_exit */
- NULL /* post read-request */
+module MODULE_VAR_EXPORT mime_module =
+{
+ STANDARD_MODULE_STUFF,
+ init_mime, /* initializer */
+ create_mime_dir_config,
+ merge_mime_dir_configs,
+ NULL, /* server config */
+ NULL, /* merge server config */
+ mime_cmds,
+ NULL, /* handlers */
+ NULL, /* filename translation */
+ NULL, /* check_user_id */
+ NULL, /* check auth */
+ NULL, /* check access */
+ find_ct, /* type_checker */
+ NULL, /* fixups */
+ NULL, /* logger */
+ NULL, /* header parser */
+ NULL, /* child_init */
+ NULL, /* child_exit */
+ NULL /* post read-request */
};