mod_include.c revision 27338fc39af80f2f0e4a8dbdc90c8a8179a5b2e4
f545d156561c08020a67f9640c51454c2df4fb57fabien/* ====================================================================
f545d156561c08020a67f9640c51454c2df4fb57fabien * The Apache Software License, Version 1.1
f545d156561c08020a67f9640c51454c2df4fb57fabien * Copyright (c) 2000-2001 The Apache Software Foundation. All rights
f545d156561c08020a67f9640c51454c2df4fb57fabien * reserved.
f545d156561c08020a67f9640c51454c2df4fb57fabien * Redistribution and use in source and binary forms, with or without
f545d156561c08020a67f9640c51454c2df4fb57fabien * modification, are permitted provided that the following conditions
f545d156561c08020a67f9640c51454c2df4fb57fabien * 1. Redistributions of source code must retain the above copyright
f545d156561c08020a67f9640c51454c2df4fb57fabien * notice, this list of conditions and the following disclaimer.
f545d156561c08020a67f9640c51454c2df4fb57fabien * 2. Redistributions in binary form must reproduce the above copyright
f545d156561c08020a67f9640c51454c2df4fb57fabien * notice, this list of conditions and the following disclaimer in
f545d156561c08020a67f9640c51454c2df4fb57fabien * the documentation and/or other materials provided with the
f545d156561c08020a67f9640c51454c2df4fb57fabien * distribution.
* Apache Software Foundation (http://www.apache.org/)."
* http_include.c: Handles the server-parsed HTML documents
#include "apr.h"
#include "apr_strings.h"
#include "apr_thread_proc.h"
#include "apr_hash.h"
#include "apr_user.h"
#include "apr_lib.h"
#include "apr_optional.h"
#define APR_WANT_STRFUNC
#include "apr_want.h"
#define CORE_PRIVATE
#include "ap_config.h"
#include "util_filter.h"
#include "httpd.h"
#include "http_config.h"
#include "http_core.h"
#include "http_request.h"
#include "http_core.h"
#include "http_protocol.h"
#include "http_log.h"
#include "http_main.h"
#include "util_script.h"
#include "http_core.h"
#include "mod_include.h"
#include "util_ebcdic.h"
char *pwname;
if (r->args) {
const char *buf;
*do_cleanup = 0;
c = buf;
return tmp_bkt;
if (*c == str[0]) {
return NULL;
const char *buf;
c = buf;
return dptr;
if (!apr_isspace(*c)) {
if (!apr_isspace(*c)) {
if ((c - buf) > 0) {
return (tmp_buck);
if (*c == str[0]) {
return NULL;
request_rec *r,
int done = 0;
const char *tmp_from;
return (APR_ENOMEM);
} while ((!done) &&
return (APR_SUCCESS);
static void decodehtml(char *s)
int val, i, j;
const char *ents;
int shift_val = 0;
*tag_val = c;
if (shift_val > 0) {
*(c-shift_val) = *c;
if (shift_val > 0) {
*(c-shift_val) = *c;
if (dodecode) {
char ch;
char *end_out;
switch (ch) {
const char *start_of_var_name;
char tmp_store;
size_t l;
++in;
++in;
++in;
if (val) {
else if (leave_name) {
next += l;
#ifdef HAVE_DRIVE_LETTERS
#ifdef NETWARE
while (*path) {
int dots = 0;
++dots;
#if defined(WIN32)
++path;
int founddupe = 0;
request_rec *p;
request_rec *q;
if (p != NULL) {
if (rr)
if (!error_fmt) {
if (error_fmt) {
!= NESTED_INCLUDE_MAGIC) {
if (val) {
switch(encode) {
int ret=0;
if (error_fmt) {
return ret;
else if (!size) {
int l, x, pos = 0;
char *t_val;
int regex_error;
return (!regex_error);
enum token_type {
struct token {
int *unmatched)
char ch;
int next = 0;
int qs = 0;
int tkn_fnd = 0;
return (char *) NULL;
return (char *) NULL;
switch (ch) {
return (string);
return (string);
return (string);
return (string);
return (string);
return (string);
if (!qs) {
* but that is (IMHO) even less readable/maintainable than the goto.
if (!qs) {
switch (ch) {
if (!tkn_fnd) {
qs = 0;
++string;
if (qs) {
next = 0;
return (string);
struct parse_node {
const char *parse;
int retval = 0;
*was_error = 0;
*was_unmatched = 0;
sizeof(struct parse_node));
case token_string:
#ifdef DEBUG_INCLUDE
case token_string:
case token_eq:
case token_ne:
case token_and:
case token_or:
case token_lbrace:
case token_not:
case token_ge:
case token_gt:
case token_le:
case token_lt:
goto RETURN;
case token_and:
case token_or:
#ifdef DEBUG_INCLUDE
goto RETURN;
case token_string:
case token_group:
case token_not:
case token_eq:
case token_ne:
case token_and:
case token_or:
case token_ge:
case token_gt:
case token_le:
case token_lt:
case token_lbrace:
goto RETURN;
case token_not:
#ifdef DEBUG_INCLUDE
case token_not:
case token_eq:
case token_ne:
case token_and:
case token_or:
case token_lbrace:
case token_ge:
case token_gt:
case token_le:
case token_lt:
goto RETURN;
case token_eq:
case token_ne:
case token_ge:
case token_gt:
case token_le:
case token_lt:
#ifdef DEBUG_INCLUDE
goto RETURN;
case token_string:
case token_group:
case token_lbrace:
case token_and:
case token_or:
case token_not:
case token_eq:
case token_ne:
case token_ge:
case token_gt:
case token_le:
case token_lt:
goto RETURN;
case token_rbrace:
#ifdef DEBUG_INCLUDE
goto RETURN;
case token_lbrace:
#ifdef DEBUG_INCLUDE
case token_not:
case token_eq:
case token_ne:
case token_and:
case token_or:
case token_lbrace:
case token_ge:
case token_gt:
case token_le:
case token_lt:
case token_string:
case token_group:
goto RETURN;
case token_string:
#ifdef DEBUG_INCLUDE
case token_and:
case token_or:
#ifdef DEBUG_INCLUDE
goto RETURN;
case token_string:
case token_string:
#ifdef DEBUG_INCLUDE
#ifdef DEBUG_INCLUDE
case token_eq:
case token_ne:
#ifdef DEBUG_INCLUDE
goto RETURN;
int len;
goto RETURN;
#ifdef DEBUG_INCLUDE
#ifdef DEBUG_INCLUDE
#ifdef DEBUG_INCLUDE
case token_ge:
case token_gt:
case token_le:
case token_lt:
#ifdef DEBUG_INCLUDE
goto RETURN;
#ifdef DEBUG_INCLUDE
#ifdef DEBUG_INCLUDE
case token_not:
#ifdef DEBUG_INCLUDE
case token_group:
#ifdef DEBUG_INCLUDE
case token_lbrace:
goto RETURN;
case token_rbrace:
goto RETURN;
goto RETURN;
return (retval);
#ifdef DEBUG_INCLUDE
if (was_error) {
if (was_unmatched) {
if (expr_ret) {
#ifdef DEBUG_INCLUDE
if (was_error) {
if (was_unmatched) {
if (expr_ret) {
#ifdef DEBUG_INCLUDE
r->filename);
ap_filter_t *f)
int ret;
int do_cleanup = 0;
r->filename);
enum xbithack {
char *default_error_msg;
char *default_time_fmt;
#ifdef XBITHACK
return result;
return result;
return NULL;
request_rec *r = f->r;
if (!f->ctx) {
return APR_ENOMEM;
ap_add_cgi_vars(r);
send_parsed_content(&b, r, f);
if (parent) {
return OK;
if(ssi_pfn_register) {
return NULL;
return NULL;
{NULL}