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