mod_include.c revision 989092d1f91497fa1a27d09e7639a586e819ce94
2362N/A * Apache Software Foundation (http://www.apache.org/)."
0N/A * http_include.c: Handles the server-parsed HTML documents
4632N/A#include "apr_strings.h"
4632N/A#include "apr_thread_proc.h"
4632N/A#include "apr_hash.h"
4632N/A#include "apr_user.h"
0N/A#include "apr_optional.h"
0N/A#define APR_WANT_STRFUNC
0N/A#define APR_WANT_MEMFUNC
0N/A#include "apr_want.h"
0N/A#include "ap_config.h"
0N/A#include "util_filter.h"
0N/A#include "http_config.h"
0N/A#include "http_core.h"
0N/A#include "http_request.h"
0N/A#include "http_core.h"
0N/A#include "http_protocol.h"
0N/A#include "http_log.h"
0N/A#include "http_main.h"
0N/A#include "util_script.h"
0N/A#include "http_core.h"
0N/A#include "mod_include.h"
0N/A#include "util_ebcdic.h"
0N/Atypedef struct result_item {
0N/A#ifdef DEBUG_INCLUDE
0N/Atypedef struct parse_node {
0N/A#ifdef DEBUG_INCLUDE
0N/A const char *default_error_msg;
0N/A const char *default_time_fmt;
0N/A const char *default_start_tag;
0N/A const char *default_end_tag;
0N/A const char *undefined_echo;
0N/Astruct ssi_internal_ctx {
0N/A request_rec *r;
0N/A#ifdef DEBUG_INCLUDE
0N/A ap_filter_t *f;
0N/A#ifdef DEBUG_INCLUDE
5036N/A char *debug__str;
0N/A case TOKEN_STRING:
0N/A case TOKEN_GROUP:
0N/A case TOKEN_RBRACE:
0N/A case TOKEN_LBRACE:
if (unmatched) { \
static const char lazy_eval_sentinel;
#ifdef XBITHACK
* | Environment/Expansion Functions
static void decodehtml(char *s)
int val, i, j;
const char *ents;
if (r->args) {
char *val;
if (val) {
return val;
const char *val;
* v.s. empty strings on an empty match is deliberate.
if (!re) {
return NULL;
return NULL;
return NULL;
return val;
if (out) {
if (out) {
return ret;
if (out) {
if (span) {
if (out) {
++outlen;
if (!ep) {
if (p < ep) {
ep = p;
++ep;
if (p < ep) {
if (!key) {
if (out) {
*out++ = *p++;
++outlen;
if (val) {
else if (leave_name) {
val = p;
if (out) {
p = newp;
if (out) {
p += span;
if (out) {
const char *ep;
return ret;
const char *rexp)
int rc;
if (!compiled) {
if (!re) {
return rc;
int unmatched;
if (!*parse) {
++*parse;
if (!**parse) {
p = *parse;
unmatched = 0;
switch (*(*parse)++) {
++*parse;
++*parse;
++*parse;
++*parse;
++*parse;
shift = 0;
if (!*(++*parse)) {
p = *parse;
++shift;
if (unmatched) {
unmatched = 0;
++*parse;
int found = 0;
switch (**parse) {
++found;
++found;
if (found) {
if (unmatched) {
while (shift--) {
memcpy(c, p, e-p);
len -= e-p;
if (len) {
return unmatched;
const char* buffer;
unsigned regex = 0;
*was_error = 0;
if (!parse) {
if (!parse) {
if (!current) {
case TOKEN_STRING:
case TOKEN_NOT:
case TOKEN_LBRACE:
return retval;
case TOKEN_STRING:
case TOKEN_STRING:
case TOKEN_RE:
case TOKEN_RBRACE:
case TOKEN_GROUP:
return retval;
case TOKEN_RE:
case TOKEN_EQ:
case TOKEN_NE:
++regex;
return retval;
case TOKEN_AND:
case TOKEN_OR:
while (current) {
case TOKEN_LBRACE:
case TOKEN_RBRACE:
return retval;
if (!current) {
case TOKEN_EQ:
case TOKEN_NE:
case TOKEN_GE:
case TOKEN_GT:
case TOKEN_LE:
case TOKEN_LT:
while (current) {
case TOKEN_STRING:
case TOKEN_RE:
case TOKEN_GROUP:
case TOKEN_LBRACE:
case TOKEN_AND:
case TOKEN_OR:
return retval;
if (!current) {
case TOKEN_RBRACE:
while (current) {
if (!current) {
return retval;
case TOKEN_NOT:
case TOKEN_LBRACE:
case TOKEN_STRING:
case TOKEN_RE:
case TOKEN_RBRACE:
case TOKEN_GROUP:
return retval;
while (current) {
case TOKEN_STRING:
case TOKEN_RE:
return retval;
case TOKEN_AND:
case TOKEN_OR:
return retval;
case TOKEN_STRING:
case TOKEN_STRING:
NULL, 0,
case TOKEN_EQ:
case TOKEN_NE:
return retval;
--regex;
case TOKEN_GE:
case TOKEN_GT:
case TOKEN_LE:
case TOKEN_LT:
return retval;
0, SSI_EXPAND_DROP_NAME);
0, SSI_EXPAND_DROP_NAME);
case TOKEN_NOT:
case TOKEN_GROUP:
case TOKEN_LBRACE:
return retval;
case TOKEN_RBRACE:
return retval;
return retval;
int ret=0;
char *newpath;
if (error_fmt) {
return ret;
request_rec *r = f->r;
r->filename);
return APR_SUCCESS;
return APR_SUCCESS;
char *parsed_string;
char *newpath;
if (!error_fmt) {
int founddupe = 0;
request_rec *p, *q;
for (q = p; q; q = q->prev) {
if (rr) {
if (error_fmt) {
r->filename);
if (rr) {
if (error_fmt) {
return APR_SUCCESS;
request_rec *r = f->r;
r->filename);
return APR_SUCCESS;
return APR_SUCCESS;
const char *val;
0, SSI_EXPAND_DROP_NAME),
ctx);
if (val) {
switch(encode) {
case E_NONE:
case E_URL:
case E_ENTITY:
return APR_SUCCESS;
request_rec *r = f->r;
r->filename);
return APR_SUCCESS;
return APR_SUCCESS;
char *parsed_string;
return APR_SUCCESS;
request_rec *r = f->r;
r->filename);
return APR_SUCCESS;
return APR_SUCCESS;
char *parsed_string;
char *buf;
char *tmp;
++len;
if (len == l) {
for (pos = x = 0; x < l; ++x) {
return APR_SUCCESS;
request_rec *r = f->r;
r->filename);
return APR_SUCCESS;
return APR_SUCCESS;
char *parsed_string;
char *t_val;
return APR_SUCCESS;
request_rec *r = f->r;
r->filename);
return APR_SUCCESS;
return APR_SUCCESS;
return APR_SUCCESS;
if (!expr) {
return APR_SUCCESS;
if (was_error) {
return APR_SUCCESS;
if (expr_ret) {
return APR_SUCCESS;
request_rec *r = f->r;
r->filename);
return APR_SUCCESS;
return APR_SUCCESS;
return APR_SUCCESS;
if (!expr) {
return APR_SUCCESS;
return APR_SUCCESS;
if (was_error) {
return APR_SUCCESS;
if (expr_ret) {
return APR_SUCCESS;
request_rec *r = f->r;
r->filename);
return APR_SUCCESS;
return APR_SUCCESS;
return APR_SUCCESS;
request_rec *r = f->r;
r->filename);
return APR_SUCCESS;
return APR_SUCCESS;
return APR_SUCCESS;
request_rec *r = f->r;
r->filename);
return APR_SUCCESS;
return APR_SUCCESS;
while (sub) {
char *parsed_string;
if (!var) {
r->filename);
return APR_SUCCESS;
request_rec *r = f->r;
r->filename);
return APR_SUCCESS;
return APR_SUCCESS;
*next = 0;
return APR_SUCCESS;
const char *skip;
while (p < he) {
skip = p;
if (p != pi) {
skip = p;
return hl;
const char *p, *ep;
return index;
if (p < ep) {
++pos;
if (p == ep) {
return index;
} while (p < ep);
return len;
const char *data,
const char *p, *ep;
*release = 0;
p = data;
++pos;
return (p - data);
if (p == ep) {
return (p - data);
++spos;
++*release;
++spos;
++*release;
--pos;
if (t == pos) {
if (pos) {
const char *p = data;
case PARSE_DIRECTIVE:
return (p - data);
case PARSE_DIRECTIVE_TAIL:
++pos;
if (p == ep) {
case PARSE_DIRECTIVE_POSTTAIL:
case PARSE_DIRECTIVE_POSTNAME:
return (p - data);
const char *p = data;
if (p < ep) {
return (p - data);
const char *p = data;
++pos;
return (p - data);
if (p == ep) {
return (p - data);
const char *p = data;
case PARSE_ARG:
return (p - data);
case PARSE_ARG_NAME:
if (p < ep) {
return (p - data);
case PARSE_ARG_POSTNAME:
while (*sp) {
++sp;
case PARSE_ARG_EQ:
if (p < ep) {
return (p - data);
case PARSE_ARG_PREVAL:
if (p < ep) {
return (p - data);
case PARSE_ARG_VAL_ESC:
case PARSE_ARG_VAL:
for (; p < ep; ++p) {
if (p == ep) {
return (p - data);
case PARSE_ARG_POSTVAL:
char *sp;
++sp;
++sp;
++shift;
if (shift) {
request_rec *r = f->r;
return APR_SUCCESS;
intern->r = r;
if (APR_BUCKET_IS_METADATA(b)) {
if (APR_BUCKET_IS_EOS(b)) {
if (APR_BUCKET_IS_FLUSH(b)) {
b = newb;
return rv;
len = 0;
return rv;
b = APR_BUCKET_NEXT(b);
case PARSE_PRE_HEAD:
b = newb;
case PARSE_HEAD:
f->c->bucket_alloc);
b = newb;
case PARSE_DIRECTIVE:
case PARSE_DIRECTIVE_POSTNAME:
case PARSE_DIRECTIVE_TAIL:
case PARSE_DIRECTIVE_POSTTAIL:
if (index) {
if (store) {
if (index) {
b = newb;
else if (index) {
b = newb;
case PARSE_PRE_ARG:
b = newb;
case PARSE_ARG:
case PARSE_ARG_NAME:
case PARSE_ARG_POSTNAME:
case PARSE_ARG_EQ:
case PARSE_ARG_PREVAL:
case PARSE_ARG_VAL:
case PARSE_ARG_VAL_ESC:
case PARSE_ARG_POSTVAL:
if (index) {
if (store) {
if (index) {
b = newb;
else if (index) {
b = newb;
case PARSE_TAIL:
case PARSE_TAIL_SEQ:
b = newb;
b = newb;
case PARSE_EXECUTE:
if (handle_func) {
return rv;
r->filename);
f->c->bucket_alloc));
return rv;
return OK;
request_rec *r = f->r;
if (!f->ctx) {
ap_add_cgi_vars(r);
/* Always unset the ETag/Last-Modified fields - see RFC2616 - 13.3.4.
if (r->args) {
return send_parsed_content(f, b);
return DECLINED;
return DECLINED;
return DECLINED;
return DECLINED;
return DECLINED;
return result;
return result;
return NULL;
const char *tag)
const char *p = tag;
if (apr_isspace(*p)) {
return NULL;
const char *tag)
const char *p = tag;
if (apr_isspace(*p)) {
return NULL;
const char *msg)
return NULL;
const char *msg)
return NULL;
const char *fmt)
return NULL;
if(ssi_pfn_register) {
return OK;
{NULL}