util_script.c revision 9df14848a9c26de425517cc4e1f2b8953891d050
d5a8d891500a642ce629854857fc00b7c21aec47Christian Maeder/* Licensed to the Apache Software Foundation (ASF) under one or more
d5a8d891500a642ce629854857fc00b7c21aec47Christian Maeder * contributor license agreements. See the NOTICE file distributed with
e9458b1a7a19a63aa4c179f9ab20f4d50681c168Jens Elkner * this work for additional information regarding copyright ownership.
d5a8d891500a642ce629854857fc00b7c21aec47Christian Maeder * The ASF licenses this file to You under the Apache License, Version 2.0
d5a8d891500a642ce629854857fc00b7c21aec47Christian Maeder * (the "License"); you may not use this file except in compliance with
98890889ffb2e8f6f722b00e265a211f13b5a861Corneliu-Claudiu Prodescu * the License. You may obtain a copy of the License at
d5a8d891500a642ce629854857fc00b7c21aec47Christian Maeder * http://www.apache.org/licenses/LICENSE-2.0
d5a8d891500a642ce629854857fc00b7c21aec47Christian Maeder * Unless required by applicable law or agreed to in writing, software
d5a8d891500a642ce629854857fc00b7c21aec47Christian Maeder * distributed under the License is distributed on an "AS IS" BASIS,
d5a8d891500a642ce629854857fc00b7c21aec47Christian Maeder * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
d5a8d891500a642ce629854857fc00b7c21aec47Christian Maeder * See the License for the specific language governing permissions and
d5a8d891500a642ce629854857fc00b7c21aec47Christian Maeder * limitations under the License.
9db2bd64088c7e5935b94dd9c3ad5cdc24f48814Christian Maeder#include "http_request.h" /* for sub_req_lookup_uri() */
d5a8d891500a642ce629854857fc00b7c21aec47Christian Maeder#include "apr_date.h" /* For apr_date_parse_http() */
d5a8d891500a642ce629854857fc00b7c21aec47Christian Maeder * Various utility functions which are common to a whole lot of
d5a8d891500a642ce629854857fc00b7c21aec47Christian Maeder * script-type extensions mechanisms, and might as well be gathered
b2a02ef0183a671777294e069307bba893ca3ebeChristian Maeder * in one place (if only to avoid creating inter-module dependancies
b2a02ef0183a671777294e069307bba893ca3ebeChristian Maeder * where there don't have to be).
d5a8d891500a642ce629854857fc00b7c21aec47Christian Maeder#define MALFORMED_MESSAGE "malformed header from script. Bad header="
d5a8d891500a642ce629854857fc00b7c21aec47Christian Maederstatic char *http2env(apr_pool_t *a, const char *w)
605065f212e589cd3ea24be7db99a71aeb858215Christian Maeder char *res = (char *)apr_palloc(a, sizeof("HTTP_") + strlen(w));
605065f212e589cd3ea24be7db99a71aeb858215Christian Maeder while ((c = *w++) != 0) {
return res;
char *tz;
char *whack;
++whack;
return env;
apr_table_t *e;
const char *rem_logname;
char *env_path;
#if defined(WIN32)
char *env_temp;
const char *host;
e = r->subprocess_env;
#ifndef SECURITY_HOLE_PASS_AUTHORIZATION
#ifdef WIN32
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;
if (r->body_table) {
return APR_SUCCESS;
if (rv) {
if (rv) {
if (len == 0) {
if (!rv) {
char *buffer;
if (!rv) {
return rv;