httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rob Hartill <hart...@hyperreal.com>
Subject fix to mod_actions.c (fwd)
Date Mon, 04 Dec 1995 19:47:03 GMT
Forwarded message:
> From khera@kci.kciLink.com  Mon Dec  4 10:56:04 1995
> Message-Id: <199512041855.NAA09332@kci.kciLink.com>
> To: Apache Bugs <apache-bugs@mail.apache.org>
> Subject: fix to mod_actions.c
> Date: Mon, 04 Dec 1995 13:55:52 -0500
> From: Vivek Khera <khera@kci.kciLink.com>
> 
> I just found another bug in the mod_actions.c file I sent a short while
> ago.  Sorry about that, but here's the replacement file.  The patch is
> relative to the original one in the contrib directory, and the full source
> is the patched version.
> 
> There is no address to send bug reports for this module, so I'm sending it
> to the general Apache bugs list.
> 
> This one definitely works...
> 
> 								v.
> 
> 
> 
> #!/bin/sh
> # This is a shell archive (produced by GNU sharutils 4.1).
> # To extract the files from this archive, save it to some FILE, remove
> # everything before the `!/bin/sh' line above, then type `sh FILE'.
> #
> # Made on 1995-12-04 13:53 EST by <khera@kci.kciLink.com>.
> # Source directory was `/home/src/kciLink/apache_1.0.0/src'.
> #
> # Existing files will *not* be overwritten unless `-c' is specified.
> #
> # This shar contains:
> # length mode       name
> # ------ ---------- ------------------------------------------
> #   1155 -rw-r--r-- adiff
> #   5355 -r--r--r-- mod_actions.c
> #
> touch -am 1231235999 $$.touch >/dev/null 2>&1
> if test ! -f 1231235999 && test -f $$.touch; then
>   shar_touch=touch
> else
>   shar_touch=:
>   echo
>   echo 'WARNING: not restoring timestamps.  Consider getting and'
>   echo "installing GNU \`touch', distributed in GNU File Utilities..."
>   echo
> fi
> rm -f 1231235999 $$.touch
> #
> # ============= adiff ==============
> if test -f 'adiff' && test X"$1" != X"-c"; then
>   echo 'x - skipping adiff (file already exists)'
> else
>   echo 'x - extracting adiff (text)'
>   sed 's/^X//' << 'SHAR_EOF' > 'adiff' &&
> *** 1.1	1995/12/02 18:56:08
> --- mod_actions.c	1995/12/04 18:46:23
> ***************
> *** 127,144 ****
> X  int action_handler (request_rec *r)
> X  {
> X      action_dir_config *conf =
> !       (action_dir_config *)get_module_config(r->per_dir_config, &action_module);
> X  
> !     if (!strcmp(table_get(conf->action_types,  r->content_type), NULL))
> !         return(DECLINED);
> X  
> X      if (r->finfo.st_mode == 0) {
> X          log_reason("File does not exist", r->filename, r);
> X          return NOT_FOUND;
> X      }
> X  
> !     internal_redirect(pstrcat (r->pool, table_get(conf->action_types,  
> !                       r->content_type), r->uri, NULL),r);
> X      return OK;
> X  }
> X  
> --- 127,143 ----
> X  int action_handler (request_rec *r)
> X  {
> X      action_dir_config *conf =
> !       (action_dir_config *)get_module_config(r->per_dir_config,&action_module);
> !     char *t = table_get(conf->action_types,  r->content_type);
> X  
> !     if (!t) return(DECLINED);
> X  
> X      if (r->finfo.st_mode == 0) {
> X          log_reason("File does not exist", r->filename, r);
> X          return NOT_FOUND;
> X      }
> X  
> !     internal_redirect(pstrcat (r->pool, t, r->uri, NULL),r);
> X      return OK;
> X  }
> X  
> SHAR_EOF
>   $shar_touch -am 1204135395 'adiff' &&
>   chmod 0644 'adiff' ||
>   echo 'restore of adiff failed'
>   shar_count="`wc -c < 'adiff'`"
>   test 1155 -eq "$shar_count" ||
>     echo "adiff: original size 1155, current size $shar_count"
> fi
> # ============= mod_actions.c ==============
> if test -f 'mod_actions.c' && test X"$1" != X"-c"; then
>   echo 'x - skipping mod_actions.c (file already exists)'
> else
>   echo 'x - extracting mod_actions.c (text)'
>   sed 's/^X//' << 'SHAR_EOF' > 'mod_actions.c' &&
> /*-
> X * Copyright (c) 1995 The Apache Group. All rights reserved.
> X * 
> X *
> X * Apache httpd license
> X * ====================
> X * 
> X *
> X * This is the license for the Apache Server. It covers all the
> X * files which come in this distribution, and should never be removed.
> X * 
> X * The "Apache Group" has based this server, called "Apache", on
> X * public domain code distributed under the name "NCSA httpd 1.3".
> X * 
> X * NCSA httpd 1.3 was placed in the public domain by the National Center 
> X * for Supercomputing Applications at the University of Illinois 
> X * at Urbana-Champaign.
> X * 
> X * As requested by NCSA we acknowledge,
> X * 
> X *  "Portions developed at the National Center for Supercomputing
> X *   Applications at the University of Illinois at Urbana-Champaign."
> X *
> X * Copyright on the sections of code added by the "Apache Group" belong
> X * to the "Apache Group" and/or the original authors. The "Apache Group" and
> X * authors hereby grant permission for their code, along with the
> X * public domain NCSA code, to be distributed under the "Apache" name.
> X * 
> X * Reuse of "Apache Group" code outside of the Apache distribution should
> X * be acknowledged with the following quoted text, to be included with any new
> X * work;
> X * 
> X * "Portions developed by the "Apache Group", taken with permission 
> X *  from the Apache Server   http://www.apache.org/apache/   "
> X *
> X *
> X * Permission is hereby granted to anyone to redistribute Apache under
> X * the "Apache" name. We do not grant permission for the resale of Apache, but
> X * we do grant permission for vendors to bundle Apache free with other software,
> X * or to charge a reasonable price for redistribution, provided it is made
> X * clear that Apache is free. Permission is also granted for vendors to 
> X * sell support for for Apache. We explicitly forbid the redistribution of 
> X * Apache under any other name.
> X * 
> X * THIS SOFTWARE IS PROVIDED BY THE CONTRIBUTORS ``AS IS'' AND
> X * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
> X * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
> X * ARE DISCLAIMED.  IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE
> X * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
> X * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
> X * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
> X * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
> X * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
> X * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
> X * SUCH DAMAGE.
> X * 
> X */
> X
> X
> X
> /*
> X * mod_action.c: executes scripts based on MIME type
> X *
> X * by Alexei Kosut; based on mod_cgi.c, mod_mime.c and mod_includes.c,
> X * adapted by rst from original NCSA code by Rob McCool
> X *
> X * Usage instructions:
> X *
> X * Action mime/type /cgi-bin/script
> X * 
> X * will activate /cgi-bin/script when a file of content type mime/type. It
> X * sends the URL and file path of the requested document using the standard
> X * CGI PATH_INFO and PATH_TRANSLATED environment variables.
> X *
> X */
> X
> #include "httpd.h"
> #include "http_config.h"
> #include "http_request.h"
> #include "http_core.h"
> #include "http_protocol.h"
> #include "http_main.h"
> #include "http_log.h"
> #include "util_script.h"
> X
> typedef struct {
> X    table *action_types;	/* Added with Action... */
> } action_dir_config;
> X
> module action_module;
> X
> void *create_action_dir_config (pool *p, char *dummy)
> {
> X    action_dir_config *new =
> X      (action_dir_config *) palloc (p, sizeof(action_dir_config));
> X
> X    new->action_types = make_table (p, 4);
> X    
> X    return new;
> }
> X
> void *merge_action_dir_configs (pool *p, void *basev, void *addv)
> {
> X    action_dir_config *base = (action_dir_config *)basev;
> X    action_dir_config *add = (action_dir_config *)addv;
> X    action_dir_config *new =
> X      (action_dir_config *)palloc (p, sizeof(action_dir_config));
> X
> X    new->action_types = overlay_tables (p, add->action_types,
> X					  base->action_types);
> X
> X    return new;
> }
> X
> char *add_action(cmd_parms *cmd, action_dir_config *m, char *type, char *script)
> {
> X    table_set (m->action_types, type, script);
> X    return NULL;
> }
> X
> command_rec action_cmds[] = {
> { "Action", add_action, NULL, OR_FILEINFO, TAKE2, 
> X    "a mime type followed by a script name" },
> { NULL }
> };
> X
> int action_handler (request_rec *r)
> {
> X    action_dir_config *conf =
> X      (action_dir_config *)get_module_config(r->per_dir_config,&action_module);
> X    char *t = table_get(conf->action_types,  r->content_type);
> X
> X    if (!t) return(DECLINED);
> X
> X    if (r->finfo.st_mode == 0) {
> X        log_reason("File does not exist", r->filename, r);
> X        return NOT_FOUND;
> X    }
> X
> X    internal_redirect(pstrcat (r->pool, t, r->uri, NULL),r);
> X    return OK;
> }
> X
> handler_rec action_handlers[] = {
> { "*/*", action_handler },
> { NULL }
> };
> X
> module action_module = {
> X   STANDARD_MODULE_STUFF,
> X   NULL,			/* initializer */
> X   create_action_dir_config,	/* dir config creater */
> X   merge_action_dir_configs,	/* dir merger --- default is to override */
> X   NULL,			/* server config */
> X   NULL,			/* merge server config */
> X   action_cmds,			/* command table */
> X   action_handlers,		/* handlers */
> X   NULL,			/* filename translation */
> X   NULL,			/* check_user_id */
> X   NULL,			/* check auth */
> X   NULL,			/* check access */
> X   NULL,			/* type_checker */
> X   NULL,			/* fixups */
> X   NULL				/* logger */
> };
> SHAR_EOF
>   $shar_touch -am 1204134695 'mod_actions.c' &&
>   chmod 0444 'mod_actions.c' ||
>   echo 'restore of mod_actions.c failed'
>   shar_count="`wc -c < 'mod_actions.c'`"
>   test 5355 -eq "$shar_count" ||
>     echo "mod_actions.c: original size 5355, current size $shar_count"
> fi
> exit 0
> 


Mime
View raw message