mod_cgi.c revision 941725dce6aacd8189eadf7a931befe57534f04d
2d3b2c0032268a32557cb03a98175b828620a706Lennart Poettering/* ====================================================================
2d3b2c0032268a32557cb03a98175b828620a706Lennart Poettering * The Apache Software License, Version 1.1
5430f7f2bc7330f3088b894166bf3524a067e3d8Lennart Poettering * Copyright (c) 2000-2002 The Apache Software Foundation. All rights
2d3b2c0032268a32557cb03a98175b828620a706Lennart Poettering * Redistribution and use in source and binary forms, with or without
2d3b2c0032268a32557cb03a98175b828620a706Lennart Poettering * modification, are permitted provided that the following conditions
2d3b2c0032268a32557cb03a98175b828620a706Lennart Poettering * 1. Redistributions of source code must retain the above copyright
* Apache Software Foundation (http://www.apache.org/)."
#include "apr.h"
#include "apr_strings.h"
#include "apr_optional.h"
#include "apr_buckets.h"
#include "apr_lib.h"
#define APR_WANT_STRFUNC
#include "apr_want.h"
#define CORE_PRIVATE
#include "util_filter.h"
#include "ap_config.h"
#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"
#include "ap_mpm.h"
#include "mod_core.h"
#include "../filters/mod_include.h"
#include "mod_cgi.h"
} exec_info;
const char *logname;
long logbytes;
int bufbytes;
cgi_server_conf *c =
&cgi_module);
return NULL;
const char *arg)
&cgi_module);
return NULL;
const char *arg)
&cgi_module);
return NULL;
{NULL}
!= APR_SUCCESS)) {
return ret;
apr_file_close(f);
return ret;
char *newline;
if (newline) {
apr_bucket *e;
const char *buf;
int first;
return ret;
&& *dbuf) {
if (APR_BUCKET_IS_EOS(e)) {
if (first) {
first = 0;
apr_file_close(f);
return ret;
if (r->args) {
const char *command,
const char * const argv[],
request_rec *r,
apr_pool_t *p,
const char * const *env;
&core_module);
#ifdef DEBUG_CGI
#ifdef OS2
#ifdef DEBUG_CGI
ap_add_cgi_vars(r);
#ifdef DEBUG_CGI
for (i = 0; env[i]; ++i)
#ifdef RLIMIT_CPU
#ifdef RLIMIT_NPROC
return rc;
if (!*script_in)
return APR_EBADF;
if (!*script_out)
return APR_EBADF;
if (!*script_err)
return APR_EBADF;
#ifdef DEBUG_CGI
return (rc);
int replace_cmd)
const char *argv0;
if (replace_cmd) {
argv0++;
++numwords;
ap_unescape_url(w);
return APR_SUCCESS;
apr_bucket *e;
const char *buf;
if (APR_BUCKET_IS_EOS(e)) {
const char *argv0;
const char *command;
const char **argv;
apr_bucket *b;
int is_included;
apr_pool_t *p;
return DECLINED;
return DECLINED;
return retval;
r->filename);
return HTTP_INTERNAL_SERVER_ERROR;
return HTTP_INTERNAL_SERVER_ERROR;
if (ap_should_client_block(r)) {
dbpos = 0;
while ((len_read =
bytes_written = 0;
const char *location;
int ret;
return OK;
return HTTP_MOVED_TEMPORARILY;
if (!r->header_only) {
int rr_status;
c->bucket_alloc);
c->bucket_alloc);
c->bucket_alloc);
c->bucket_alloc);
c->bucket_alloc);
const char **argv;
apr_bucket *b;
r->filename);
return HTTP_INTERNAL_SERVER_ERROR;
return HTTP_INTERNAL_SERVER_ERROR;
return retval;
if (!cgi_build_command) {
return OK;