util_script.c revision c8dcde16853eef36b713d4633fac83b66e49aa5e
7906201913b68fe78b9d6a22ab33bf21d82c490eminfrin/* Licensed to the Apache Software Foundation (ASF) under one or more
7906201913b68fe78b9d6a22ab33bf21d82c490eminfrin * contributor license agreements. See the NOTICE file distributed with
fd9abdda70912b99b24e3bf1a38f26fde908a74cnd * this work for additional information regarding copyright ownership.
fd9abdda70912b99b24e3bf1a38f26fde908a74cnd * The ASF licenses this file to You under the Apache License, Version 2.0
fd9abdda70912b99b24e3bf1a38f26fde908a74cnd * (the "License"); you may not use this file except in compliance with
7906201913b68fe78b9d6a22ab33bf21d82c490eminfrin * the License. You may obtain a copy of the License at
96ad5d81ee4a2cc66a4ae19893efc8aa6d06fae7jailletc * Unless required by applicable law or agreed to in writing, software
7906201913b68fe78b9d6a22ab33bf21d82c490eminfrin * distributed under the License is distributed on an "AS IS" BASIS,
7906201913b68fe78b9d6a22ab33bf21d82c490eminfrin * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
d29d9ab4614ff992b0e8de6e2b88d52b6f1f153erbowen * See the License for the specific language governing permissions and
2e545ce2450a9953665f701bb05350f0d3f26275nd * limitations under the License.
7906201913b68fe78b9d6a22ab33bf21d82c490eminfrin#include "http_request.h" /* for sub_req_lookup_uri() */
7906201913b68fe78b9d6a22ab33bf21d82c490eminfrin#include "apr_date.h" /* For apr_date_parse_http() */
7906201913b68fe78b9d6a22ab33bf21d82c490eminfrin * Various utility functions which are common to a whole lot of
7906201913b68fe78b9d6a22ab33bf21d82c490eminfrin * script-type extensions mechanisms, and might as well be gathered
7906201913b68fe78b9d6a22ab33bf21d82c490eminfrin * in one place (if only to avoid creating inter-module dependancies
7906201913b68fe78b9d6a22ab33bf21d82c490eminfrin * where there don't have to be).
7906201913b68fe78b9d6a22ab33bf21d82c490eminfrin#define MALFORMED_MESSAGE "malformed header from script. Bad header="
7906201913b68fe78b9d6a22ab33bf21d82c490eminfrin char *res = (char *)apr_palloc(a, sizeof("HTTP_") + strlen(w));
7906201913b68fe78b9d6a22ab33bf21d82c490eminfrin while ((c = *w++) != 0) {
727872d18412fc021f03969b8641810d8896820bhumbedoohAP_DECLARE(char **) ap_create_environment(apr_pool_t *p, apr_table_t *t)
727872d18412fc021f03969b8641810d8896820bhumbedooh const apr_array_header_t *env_arr = apr_table_elts(t);
cc7e1025de9ac63bd4db6fe7f71c158b2cf09fe4humbedooh const apr_table_entry_t *elts = (const apr_table_entry_t *) env_arr->elts;
0d0ba3a410038e179b695446bb149cce6264e0abnd char **env = (char **) apr_palloc(p, (env_arr->nelts + 2) * sizeof(char *));
0d0ba3a410038e179b695446bb149cce6264e0abnd env[j] = apr_pstrcat(p, elts[i].key, "=", elts[i].val, NULL);
++whack;
return env;
apr_table_t *e;
const char *rem_logname;
const char *env_path;
const char *env_temp;
const char *host;
e = r->subprocess_env;
#ifndef SECURITY_HOLE_PASS_AUTHORIZATION
#ifdef WIN32
#ifdef OS2
if (host) {
if (r->user) {
else if (r->prev) {
while (back) {
if (r->ap_auth_type) {
if (rem_logname) {
if (r->prev) {
if (e != r->subprocess_env) {
lu = 0;
lu++;
return lu;
NULL);
NULL);
#ifdef WIN32
int (*getsfunc) (char *, int, void *),
void *getsfunc_data)
char x[MAX_STRING_LEN];
if (buffer) {
if (rv == 0) {
return HTTP_INTERNAL_SERVER_ERROR;
return HTTP_GATEWAY_TIME_OUT;
p = strlen(w);
return cond_status;
++maybeEBCDIC;
++maybeASCII;
r->filename);
if (!buffer) {
return HTTP_INTERNAL_SERVER_ERROR;
while (*l && apr_isspace(*l)) {
char *tmp;
return OK;
char *buffer)
int done = 0;
const char *bucket_data;
const char *src;
const char *src_end;
src++;
e = next;
*dst = 0;
char *buffer)
struct vastrs {
int arg;
const char *curpos;
if (t > len)
t = len;
char *buffer,
const char **termch,
int *termarg, ...)
int res;
if (termch)
if (termarg)
return res;
char *key;
char *value;
char *strtok_state;
while (key) {
if (value) {
*table = t;