mod_cgi.h revision 2fe2d6ca1223e3ea902ea3f042a2b8c94ad01816
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholes/* Copyright 2001-2004 The Apache Software Foundation
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholes *
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholes * Licensed under the Apache License, Version 2.0 (the "License");
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholes * you may not use this file except in compliance with the License.
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholes * You may obtain a copy of the License at
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholes *
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholes * http://www.apache.org/licenses/LICENSE-2.0
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholes *
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholes * Unless required by applicable law or agreed to in writing, software
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholes * distributed under the License is distributed on an "AS IS" BASIS,
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholes * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholes * See the License for the specific language governing permissions and
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholes * limitations under the License.
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholes */
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholes
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholes#ifndef _MOD_CGI_H
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholes#define _MOD_CGI_H 1
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholes
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholes#include "mod_include.h"
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholes
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholestypedef enum {RUN_AS_SSI, RUN_AS_CGI} prog_types;
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholes
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholestypedef struct {
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholes apr_int32_t in_pipe;
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholes apr_int32_t out_pipe;
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholes apr_int32_t err_pipe;
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholes int process_cgi;
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholes apr_cmdtype_e cmd_type;
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholes apr_int32_t detached;
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholes prog_types prog_type;
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholes apr_bucket_brigade **bb;
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholes include_ctx_t *ctx;
5c0419d51818eb02045cf923a9fe456127a44c60wrowe ap_filter_t *next;
5c0419d51818eb02045cf923a9fe456127a44c60wrowe apr_int32_t addrspace;
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholes} cgi_exec_info_t;
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholes
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholes/**
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholes * Registerable optional function to override CGI behavior;
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholes * Reprocess the command and arguments to execute the given CGI script.
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholes * @param cmd Pointer to the command to execute (may be overridden)
d266c3777146d36a4c23c17aad6f153aebea1bf4jorton * @param argv Pointer to the arguments to pass (may be overridden)
d266c3777146d36a4c23c17aad6f153aebea1bf4jorton * @param r The current request
d266c3777146d36a4c23c17aad6f153aebea1bf4jorton * @param p The pool to allocate correct cmd/argv elements within.
d266c3777146d36a4c23c17aad6f153aebea1bf4jorton * @param process_cgi Set true if processing r->filename and r->args
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholes * as a CGI invocation, otherwise false
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholes * @param type Set to APR_SHELLCMD or APR_PROGRAM on entry, may be
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholes * changed to invoke the program with alternate semantics.
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholes * @param detach Should the child start in detached state? Default is no.
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholes * @remark This callback may be registered by the os-specific module
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholes * to correct the command and arguments for apr_proc_create invocation
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholes * on a given os. mod_cgi will call the function if registered.
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholes */
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholesAPR_DECLARE_OPTIONAL_FN(apr_status_t, ap_cgi_build_command,
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholes (const char **cmd, const char ***argv,
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholes request_rec *r, apr_pool_t *p,
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholes cgi_exec_info_t *e_info));
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholes
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholes#endif /* _MOD_CGI_H */
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholes