mod_actions.c revision b6055b7832a0e4d0818416252fff5925aaebae4b
e655a84bbb62bb1c66993fda5e74b04feda14dc6kess/* ====================================================================
e655a84bbb62bb1c66993fda5e74b04feda14dc6kess * The Apache Software License, Version 1.1
e655a84bbb62bb1c66993fda5e74b04feda14dc6kess * Copyright (c) 2000 The Apache Software Foundation. All rights
e655a84bbb62bb1c66993fda5e74b04feda14dc6kess * reserved.
e655a84bbb62bb1c66993fda5e74b04feda14dc6kess * Redistribution and use in source and binary forms, with or without
e655a84bbb62bb1c66993fda5e74b04feda14dc6kess * modification, are permitted provided that the following conditions
e655a84bbb62bb1c66993fda5e74b04feda14dc6kess * are met:
e655a84bbb62bb1c66993fda5e74b04feda14dc6kess * 1. Redistributions of source code must retain the above copyright
e655a84bbb62bb1c66993fda5e74b04feda14dc6kess * notice, this list of conditions and the following disclaimer.
e655a84bbb62bb1c66993fda5e74b04feda14dc6kess * 2. Redistributions in binary form must reproduce the above copyright
27e52281f1522522b170cafc76b08b58aa70ccaand * notice, this list of conditions and the following disclaimer in
e655a84bbb62bb1c66993fda5e74b04feda14dc6kess * the documentation and/or other materials provided with the
e655a84bbb62bb1c66993fda5e74b04feda14dc6kess * distribution.
4b5981e276e93df97c34e4da05ca5cf8bbd937dand * 3. The end-user documentation included with the redistribution,
e655a84bbb62bb1c66993fda5e74b04feda14dc6kess * if any, must include the following acknowledgment:
e655a84bbb62bb1c66993fda5e74b04feda14dc6kess * "This product includes software developed by the
e655a84bbb62bb1c66993fda5e74b04feda14dc6kess * Apache Software Foundation (http://www.apache.org/)."
e655a84bbb62bb1c66993fda5e74b04feda14dc6kess * Alternately, this acknowledgment may appear in the software itself,
1c8f2418892d98febb00a06b9a4f45f8bcfd80a3nd * if and wherever such third-party acknowledgments normally appear.
fac8c35bfb158112226ab43ddf84d59daca5dc30nd * 4. The names "Apache" and "Apache Software Foundation" must
d474d8ef01ec5c2a09341cd148851ed383c3287crbowen * not be used to endorse or promote products derived from this
d474d8ef01ec5c2a09341cd148851ed383c3287crbowen * software without prior written permission. For written
e655a84bbb62bb1c66993fda5e74b04feda14dc6kess * permission, please contact apache@apache.org.
b03f9485e6dfcf9326e6122f91eaa1ced8939818jim * 5. Products derived from this software may not be called "Apache",
b03f9485e6dfcf9326e6122f91eaa1ced8939818jim * nor may "Apache" appear in their name, without prior written
e655a84bbb62bb1c66993fda5e74b04feda14dc6kess * permission of the Apache Software Foundation.
e655a84bbb62bb1c66993fda5e74b04feda14dc6kess * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
e655a84bbb62bb1c66993fda5e74b04feda14dc6kess * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
e655a84bbb62bb1c66993fda5e74b04feda14dc6kess * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
e655a84bbb62bb1c66993fda5e74b04feda14dc6kess * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
e655a84bbb62bb1c66993fda5e74b04feda14dc6kess * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
e655a84bbb62bb1c66993fda5e74b04feda14dc6kess * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
e655a84bbb62bb1c66993fda5e74b04feda14dc6kess * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
e655a84bbb62bb1c66993fda5e74b04feda14dc6kess * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
e655a84bbb62bb1c66993fda5e74b04feda14dc6kess * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
e655a84bbb62bb1c66993fda5e74b04feda14dc6kess * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
e655a84bbb62bb1c66993fda5e74b04feda14dc6kess * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
e655a84bbb62bb1c66993fda5e74b04feda14dc6kess * SUCH DAMAGE.
e655a84bbb62bb1c66993fda5e74b04feda14dc6kess * ====================================================================
e655a84bbb62bb1c66993fda5e74b04feda14dc6kess * This software consists of voluntary contributions made by many
e655a84bbb62bb1c66993fda5e74b04feda14dc6kess * individuals on behalf of the Apache Software Foundation. For more
e655a84bbb62bb1c66993fda5e74b04feda14dc6kess * information on the Apache Software Foundation, please see
e655a84bbb62bb1c66993fda5e74b04feda14dc6kess * Portions of this software are based upon public domain software
e655a84bbb62bb1c66993fda5e74b04feda14dc6kess * originally written at the National Center for Supercomputing Applications,
e655a84bbb62bb1c66993fda5e74b04feda14dc6kess * University of Illinois, Urbana-Champaign.
e655a84bbb62bb1c66993fda5e74b04feda14dc6kess * mod_actions.c: executes scripts based on MIME type or HTTP method
e655a84bbb62bb1c66993fda5e74b04feda14dc6kess * by Alexei Kosut; based on mod_cgi.c, mod_mime.c and mod_includes.c,
e655a84bbb62bb1c66993fda5e74b04feda14dc6kess * adapted by rst from original NCSA code by Rob McCool
e655a84bbb62bb1c66993fda5e74b04feda14dc6kess * Usage instructions:
e655a84bbb62bb1c66993fda5e74b04feda14dc6kess * will activate /cgi-bin/script when a file of content type mime/type is
e655a84bbb62bb1c66993fda5e74b04feda14dc6kess * requested. It sends the URL and file path of the requested document using
e655a84bbb62bb1c66993fda5e74b04feda14dc6kess * the standard CGI PATH_INFO and PATH_TRANSLATED environment variables.
e655a84bbb62bb1c66993fda5e74b04feda14dc6kess * Script PUT /cgi-bin/script
e655a84bbb62bb1c66993fda5e74b04feda14dc6kess * will activate /cgi-bin/script when a request is received with the
e655a84bbb62bb1c66993fda5e74b04feda14dc6kess * HTTP method "PUT". The available method names are defined in httpd.h.
e655a84bbb62bb1c66993fda5e74b04feda14dc6kess * If the method is GET, the script will only be activated if the requested
e655a84bbb62bb1c66993fda5e74b04feda14dc6kess * URI includes query information (stuff after a ?-mark).
e655a84bbb62bb1c66993fda5e74b04feda14dc6kesstypedef struct {
e655a84bbb62bb1c66993fda5e74b04feda14dc6kess const char *scripted[METHODS]; /* Added with Script... */
e655a84bbb62bb1c66993fda5e74b04feda14dc6kessstatic void *create_action_dir_config(ap_pool_t *p, char *dummy)
e655a84bbb62bb1c66993fda5e74b04feda14dc6kess (action_dir_config *) ap_palloc(p, sizeof(action_dir_config));
e655a84bbb62bb1c66993fda5e74b04feda14dc6kessstatic void *merge_action_dir_configs(ap_pool_t *p, void *basev, void *addv)
e655a84bbb62bb1c66993fda5e74b04feda14dc6kess action_dir_config *new = (action_dir_config *) ap_palloc(p,
e655a84bbb62bb1c66993fda5e74b04feda14dc6kess new->action_types = ap_overlay_tables(p, add->action_types,
e655a84bbb62bb1c66993fda5e74b04feda14dc6kess for (i = 0; i < METHODS; ++i) {
int methnum;
return NULL;
{NULL}
const char *script;
for (i = 0; i < METHODS; ++i) {
if (r->args)
return DECLINED;
script = t;
return HTTP_NOT_FOUND;
return DECLINED;
return OK;
{NULL}