Apache2
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
cgi_common.h
Go to the documentation of this file.
1 /* Licensed to the Apache Software Foundation (ASF) under one or more
2  * contributor license agreements. See the NOTICE file distributed with
3  * this work for additional information regarding copyright ownership.
4  * The ASF licenses this file to You under the Apache License, Version 2.0
5  * (the "License"); you may not use this file except in compliance with
6  * the License. You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #include "apr.h"
18 #include "apr_strings.h"
19 #include "apr_buckets.h"
20 #include "apr_lib.h"
21 #include "apr_poll.h"
22 
23 #define APR_WANT_STRFUNC
24 #define APR_WANT_MEMFUNC
25 #include "apr_want.h"
26 
27 #include "httpd.h"
28 #include "util_filter.h"
29 
31 static APR_OPTIONAL_FN_TYPE(ap_ssi_parse_string) *cgi_pfn_ps;
32 
33 /* These functions provided by mod_cgi.c/mod_cgid.c still. */
34 static int log_script(request_rec *r, cgi_server_conf * conf, int ret,
35  char *dbuf, const char *sbuf, apr_bucket_brigade *bb,
36  apr_file_t *script_err);
37 static apr_status_t include_cgi(include_ctx_t *ctx, ap_filter_t *f,
38  apr_bucket_brigade *bb, char *s);
39 static apr_status_t include_cmd(include_ctx_t *ctx, ap_filter_t *f,
40  apr_bucket_brigade *bb, const char *command);
41 
42 /* Read and discard all output from the brigade. Note that with the
43  * CGI bucket, the brigade will become empty once the script's stdout
44  * is closed (or on error/timeout), but the stderr output may not have
45  * been entirely captured at this point. */
46 static void discard_script_output(apr_bucket_brigade *bb)
47 {
48  apr_bucket *e;
49  const char *buf;
50  apr_size_t len;
51 
52  for (e = APR_BRIGADE_FIRST(bb);
54  e = APR_BRIGADE_FIRST(bb))
55  {
56  if (apr_bucket_read(e, &buf, &len, APR_BLOCK_READ)) {
57  break;
58  }
60  }
61 }
62 
63 static int log_scripterror(request_rec *r, cgi_server_conf *conf, int ret,
64  apr_status_t rv, const char *logno,
65  const char *error)
66 {
67  apr_file_t *f = NULL;
68  apr_finfo_t finfo;
69  char time_str[APR_CTIME_LEN];
70 
71  /* Intentional no APLOGNO */
72  /* Callee provides APLOGNO in error text */
74  "%sstderr from %s: %s", logno ? logno : "", r->filename, error);
75 
76  /* XXX Very expensive mainline case! Open, then getfileinfo! */
77  if (!conf->logname ||
78  ((apr_stat(&finfo, conf->logname,
79  APR_FINFO_SIZE, r->pool) == APR_SUCCESS) &&
80  (finfo.size > conf->logbytes)) ||
81  (apr_file_open(&f, conf->logname,
83  r->pool) != APR_SUCCESS)) {
84  return ret;
85  }
86 
87  /* "%% [Wed Jun 19 10:53:21 1996] GET /cgi-bin/printenv HTTP/1.0" */
88  apr_ctime(time_str, apr_time_now());
89  apr_file_printf(f, "%%%% [%s] %s %s%s%s %s\n", time_str, r->method, r->uri,
90  r->args ? "?" : "", r->args ? r->args : "", r->protocol);
91  /* "%% 500 /usr/local/apache/cgi-bin */
92  apr_file_printf(f, "%%%% %d %s\n", ret, r->filename);
93 
94  apr_file_printf(f, "%%error\n%s\n", error);
95 
96  apr_file_close(f);
97  return ret;
98 }
99 
100 /* Soak up stderr from a script and redirect it to the error log.
101  */
102 static apr_status_t log_script_err(request_rec *r, apr_file_t *script_err)
103 {
104  char argsbuffer[HUGE_STRING_LEN];
105  char *newline;
106  apr_status_t rv;
107  cgi_server_conf *conf = ap_get_module_config(r->server->module_config, &cgi_module);
108 
109  while ((rv = apr_file_gets(argsbuffer, HUGE_STRING_LEN,
110  script_err)) == APR_SUCCESS) {
111 
112  newline = strchr(argsbuffer, '\n');
113  if (newline) {
114  char *prev = newline - 1;
115  if (prev >= argsbuffer && *prev == '\r') {
116  newline = prev;
117  }
118 
119  *newline = '\0';
120  }
121  log_scripterror(r, conf, r->status, 0, APLOGNO(01215), argsbuffer);
122  }
123 
124  return rv;
125 }
126 
127 static apr_status_t cgi_handle_exec(include_ctx_t *ctx, ap_filter_t *f,
128  apr_bucket_brigade *bb)
129 {
130  char *tag = NULL;
131  char *tag_val = NULL;
132  request_rec *r = f->r;
133  char *file = r->filename;
134  char parsed_string[MAX_STRING_LEN];
135 
136  if (!ctx->argc) {
138  (ctx->flags & SSI_FLAG_PRINTING)
140  0, r, APLOGNO(03195)
141  "missing argument for exec element in %s", r->filename);
142  }
143 
144  if (!(ctx->flags & SSI_FLAG_PRINTING)) {
145  return APR_SUCCESS;
146  }
147 
148  if (!ctx->argc) {
149  SSI_CREATE_ERROR_BUCKET(ctx, f, bb);
150  return APR_SUCCESS;
151  }
152 
153  if (ctx->flags & SSI_FLAG_NO_EXEC) {
154  ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, APLOGNO(01228) "exec used but not allowed "
155  "in %s", r->filename);
156  SSI_CREATE_ERROR_BUCKET(ctx, f, bb);
157  return APR_SUCCESS;
158  }
159 
160  while (1) {
161  cgi_pfn_gtv(ctx, &tag, &tag_val, SSI_VALUE_DECODED);
162  if (!tag || !tag_val) {
163  break;
164  }
165 
166  if (!strcmp(tag, "cmd")) {
167  apr_status_t rv;
168 
169  cgi_pfn_ps(ctx, tag_val, parsed_string, sizeof(parsed_string),
171 
172  rv = include_cmd(ctx, f, bb, parsed_string);
173  if (rv != APR_SUCCESS) {
174  ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, APLOGNO(01229) "execution failure "
175  "for parameter \"%s\" to tag exec in file %s",
176  tag, r->filename);
177  SSI_CREATE_ERROR_BUCKET(ctx, f, bb);
178  break;
179  }
180  }
181  else if (!strcmp(tag, "cgi")) {
182  apr_status_t rv;
183 
184  cgi_pfn_ps(ctx, tag_val, parsed_string, sizeof(parsed_string),
186 
187  rv = include_cgi(ctx, f, bb, parsed_string);
188  if (rv != APR_SUCCESS) {
189  ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, APLOGNO(01230) "invalid CGI ref "
190  "\"%s\" in %s", tag_val, file);
191  SSI_CREATE_ERROR_BUCKET(ctx, f, bb);
192  break;
193  }
194  }
195  else {
196  ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, APLOGNO(01231) "unknown parameter "
197  "\"%s\" to tag exec in %s", tag, file);
198  SSI_CREATE_ERROR_BUCKET(ctx, f, bb);
199  break;
200  }
201  }
202 
203  return APR_SUCCESS;
204 }
205 
206 /* Hook to register exec= handling with mod_include. */
207 static void cgi_optfns_retrieve(void)
208 {
209  APR_OPTIONAL_FN_TYPE(ap_register_include_handler) *cgi_pfn_reg_with_ssi;
210 
214 
215  if (cgi_pfn_reg_with_ssi && cgi_pfn_gtv && cgi_pfn_ps) {
216  /* Required by mod_include filter. This is how mod_cgi registers
217  * with mod_include to provide processing of the exec directive.
218  */
219  cgi_pfn_reg_with_ssi("exec", cgi_handle_exec);
220  }
221 }
222 
223 #ifdef WANT_CGI_BUCKET
224 /* A CGI bucket type is needed to catch any output to stderr from the
225  * script; see PR 22030. */
226 static const apr_bucket_type_t bucket_type_cgi;
227 
228 struct cgi_bucket_data {
229  apr_pollset_t *pollset;
230  request_rec *r;
231  apr_interval_time_t timeout;
232 };
233 
234 /* Create a CGI bucket using pipes from script stdout 'out'
235  * and stderr 'err', for request 'r'. */
236 static apr_bucket *cgi_bucket_create(request_rec *r,
237  apr_interval_time_t timeout,
238  apr_file_t *out, apr_file_t *err,
239  apr_bucket_alloc_t *list)
240 {
241  apr_bucket *b = apr_bucket_alloc(sizeof(*b), list);
242  apr_status_t rv;
243  apr_pollfd_t fd;
244  struct cgi_bucket_data *data = apr_palloc(r->pool, sizeof *data);
245 
246  /* Disable APR timeout handling since we'll use poll() entirely. */
249 
250  APR_BUCKET_INIT(b);
251  b->free = apr_bucket_free;
252  b->list = list;
253  b->type = &bucket_type_cgi;
254  b->length = (apr_size_t)(-1);
255  b->start = -1;
256 
257  /* Create the pollset */
258  rv = apr_pollset_create(&data->pollset, 2, r->pool, 0);
259  if (rv != APR_SUCCESS) {
260  ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r, APLOGNO(01217)
261  "apr_pollset_create(); check system or user limits");
262  return NULL;
263  }
264 
266  fd.reqevents = APR_POLLIN;
267  fd.p = r->pool;
268  fd.desc.f = out; /* script's stdout */
269  fd.client_data = (void *)1;
270  rv = apr_pollset_add(data->pollset, &fd);
271  if (rv != APR_SUCCESS) {
272  ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r, APLOGNO(01218)
273  "apr_pollset_add(); check system or user limits");
274  return NULL;
275  }
276 
277  fd.desc.f = err; /* script's stderr */
278  fd.client_data = (void *)2;
279  rv = apr_pollset_add(data->pollset, &fd);
280  if (rv != APR_SUCCESS) {
281  ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r, APLOGNO(01219)
282  "apr_pollset_add(); check system or user limits");
283  return NULL;
284  }
285 
286  data->r = r;
287  data->timeout = timeout;
288  b->data = data;
289  return b;
290 }
291 
292 /* Create a duplicate CGI bucket using given bucket data */
293 static apr_bucket *cgi_bucket_dup(struct cgi_bucket_data *data,
294  apr_bucket_alloc_t *list)
295 {
296  apr_bucket *b = apr_bucket_alloc(sizeof(*b), list);
297  APR_BUCKET_INIT(b);
298  b->free = apr_bucket_free;
299  b->list = list;
300  b->type = &bucket_type_cgi;
301  b->length = (apr_size_t)(-1);
302  b->start = -1;
303  b->data = data;
304  return b;
305 }
306 
307 /* Handle stdout from CGI child. Duplicate of logic from the _read
308  * method of the real APR pipe bucket implementation. */
309 static apr_status_t cgi_read_stdout(apr_bucket *a, apr_file_t *out,
310  const char **str, apr_size_t *len)
311 {
312  char *buf;
313  apr_status_t rv;
314 
315  *str = NULL;
316  *len = APR_BUCKET_BUFF_SIZE;
317  buf = apr_bucket_alloc(*len, a->list); /* XXX: check for failure? */
318 
319  rv = apr_file_read(out, buf, len);
320 
321  if (rv != APR_SUCCESS && rv != APR_EOF) {
322  apr_bucket_free(buf);
323  return rv;
324  }
325 
326  if (*len > 0) {
327  struct cgi_bucket_data *data = a->data;
328  apr_bucket_heap *h;
329 
330  /* Change the current bucket to refer to what we read */
331  a = apr_bucket_heap_make(a, buf, *len, apr_bucket_free);
332  h = a->data;
333  h->alloc_len = APR_BUCKET_BUFF_SIZE; /* note the real buffer size */
334  *str = buf;
335  APR_BUCKET_INSERT_AFTER(a, cgi_bucket_dup(data, a->list));
336  }
337  else {
338  apr_bucket_free(buf);
339  a = apr_bucket_immortal_make(a, "", 0);
340  *str = a->data;
341  }
342  return rv;
343 }
344 
345 /* Read method of CGI bucket: polls on stderr and stdout of the child,
346  * sending any stderr output immediately away to the error log. */
347 static apr_status_t cgi_bucket_read(apr_bucket *b, const char **str,
348  apr_size_t *len, apr_read_type_e block)
349 {
350  struct cgi_bucket_data *data = b->data;
351  apr_interval_time_t timeout = 0;
352  apr_status_t rv;
353  int gotdata = 0;
354 
355  if (block != APR_NONBLOCK_READ) {
356  timeout = data->timeout > 0 ? data->timeout : data->r->server->timeout;
357  }
358 
359  do {
360  const apr_pollfd_t *results;
361  apr_int32_t num;
362 
363  rv = apr_pollset_poll(data->pollset, timeout, &num, &results);
364  if (APR_STATUS_IS_TIMEUP(rv)) {
365  if (timeout) {
366  ap_log_rerror(APLOG_MARK, APLOG_WARNING, 0, data->r, APLOGNO(01220)
367  "Timeout waiting for output from CGI script %s",
368  data->r->filename);
369  return rv;
370  }
371  else {
372  return APR_EAGAIN;
373  }
374  }
375  else if (APR_STATUS_IS_EINTR(rv)) {
376  continue;
377  }
378  else if (rv != APR_SUCCESS) {
379  ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, data->r, APLOGNO(01221)
380  "poll failed waiting for CGI child");
381  return rv;
382  }
383 
384  for (; num; num--, results++) {
385  if (results[0].client_data == (void *)1) {
386  /* stdout */
387  rv = cgi_read_stdout(b, results[0].desc.f, str, len);
388  if (APR_STATUS_IS_EOF(rv)) {
389  rv = APR_SUCCESS;
390  }
391  gotdata = 1;
392  } else {
393  /* stderr */
394  apr_status_t rv2 = log_script_err(data->r, results[0].desc.f);
395  if (APR_STATUS_IS_EOF(rv2)) {
396  apr_pollset_remove(data->pollset, &results[0]);
397  }
398  }
399  }
400 
401  } while (!gotdata);
402 
403  return rv;
404 }
405 
406 static const apr_bucket_type_t bucket_type_cgi = {
407  "CGI", 5, APR_BUCKET_DATA,
409  cgi_bucket_read,
413 };
414 
415 #endif /* WANT_CGI_BUCKET */
416 
417 /* Handle the CGI response output, having set up the brigade with the
418  * CGI or PIPE bucket as appropriate. */
419 static int cgi_handle_response(request_rec *r, int nph, apr_bucket_brigade *bb,
420  apr_interval_time_t timeout, cgi_server_conf *conf,
421  char *logdata, apr_file_t *script_err)
422 {
423  apr_status_t rv;
424 
425  /* Handle script return... */
426  if (!nph) {
427  const char *location;
428  char sbuf[MAX_STRING_LEN];
429  int ret;
430 
431  if ((ret = ap_scan_script_header_err_brigade_ex(r, bb, sbuf,
433  {
434  /* In the case of a timeout reading script output, clear
435  * the brigade to avoid a second attempt to read the
436  * output. */
437  if (ret == HTTP_GATEWAY_TIME_OUT) {
439  }
440 
441  ret = log_script(r, conf, ret, logdata, sbuf, bb, script_err);
442 
443  /*
444  * ret could be HTTP_NOT_MODIFIED in the case that the CGI script
445  * does not set an explicit status and ap_meets_conditions, which
446  * is called by ap_scan_script_header_err_brigade, detects that
447  * the conditions of the requests are met and the response is
448  * not modified.
449  * In this case set r->status and return OK in order to prevent
450  * running through the error processing stack as this would
451  * break with mod_cache, if the conditions had been set by
452  * mod_cache itself to validate a stale entity.
453  * BTW: We circumvent the error processing stack anyway if the
454  * CGI script set an explicit status code (whatever it is) and
455  * the only possible values for ret here are:
456  *
457  * HTTP_NOT_MODIFIED (set by ap_meets_conditions)
458  * HTTP_PRECONDITION_FAILED (set by ap_meets_conditions)
459  * HTTP_INTERNAL_SERVER_ERROR (if something went wrong during the
460  * processing of the response of the CGI script, e.g broken headers
461  * or a crashed CGI process).
462  */
463  if (ret == HTTP_NOT_MODIFIED) {
464  r->status = ret;
465  return OK;
466  }
467 
468  return ret;
469  }
470 
471  location = apr_table_get(r->headers_out, "Location");
472 
473  if (location && r->status == 200) {
474  /* For a redirect whether internal or not, discard any
475  * remaining stdout from the script, and log any remaining
476  * stderr output, as normal. */
477  discard_script_output(bb);
479 
480  if (script_err) {
481  apr_file_pipe_timeout_set(script_err, timeout);
482  log_script_err(r, script_err);
483  }
484  }
485 
486  if (location && location[0] == '/' && r->status == 200) {
487  /* This redirect needs to be a GET no matter what the original
488  * method was.
489  */
490  r->method = "GET";
491  r->method_number = M_GET;
492 
493  /* We already read the message body (if any), so don't allow
494  * the redirected request to think it has one. We can ignore
495  * Transfer-Encoding, since we used REQUEST_CHUNKED_ERROR.
496  */
497  apr_table_unset(r->headers_in, "Content-Length");
498 
499  ap_internal_redirect_handler(location, r);
500  return OK;
501  }
502  else if (location && r->status == 200) {
503  /* XXX: Note that if a script wants to produce its own Redirect
504  * body, it now has to explicitly *say* "Status: 302"
505  */
506  discard_script_output(bb);
508  return HTTP_MOVED_TEMPORARILY;
509  }
510 
511  rv = ap_pass_brigade(r->output_filters, bb);
512  }
513  else /* nph */ {
514  struct ap_filter_t *cur;
515 
516  /* get rid of all filters up through protocol... since we
517  * haven't parsed off the headers, there is no way they can
518  * work
519  */
520 
521  cur = r->proto_output_filters;
522  while (cur && cur->frec->ftype < AP_FTYPE_CONNECTION) {
523  cur = cur->next;
524  }
525  r->output_filters = r->proto_output_filters = cur;
526 
527  rv = ap_pass_brigade(r->output_filters, bb);
528  }
529 
530  /* don't soak up script output if errors occurred writing it
531  * out... otherwise, we prolong the life of the script when the
532  * connection drops or we stopped sending output for some other
533  * reason */
534  if (script_err && rv == APR_SUCCESS && !r->connection->aborted) {
535  apr_file_pipe_timeout_set(script_err, timeout);
536  log_script_err(r, script_err);
537  }
538 
539  if (script_err) apr_file_close(script_err);
540 
541  return OK; /* NOT r->status, even if it has changed. */
542 }
543 
544 /* Read the request body and write it to fd 'script_out', using 'bb'
545  * as temporary bucket brigade. If 'logbuf' is non-NULL, the first
546  * logbufbytes of stdout are stored in logbuf. */
547 static apr_status_t cgi_handle_request(request_rec *r, apr_file_t *script_out,
548  apr_bucket_brigade *bb,
549  char *logbuf, apr_size_t logbufbytes)
550 {
551  int seen_eos = 0;
552  int child_stopped_reading = 0;
553  apr_status_t rv;
554  int dbpos = 0;
555 
556  do {
557  apr_bucket *bucket;
558 
561 
562  if (rv != APR_SUCCESS) {
563  return rv;
564  }
565 
566  for (bucket = APR_BRIGADE_FIRST(bb);
567  bucket != APR_BRIGADE_SENTINEL(bb);
568  bucket = APR_BUCKET_NEXT(bucket))
569  {
570  const char *data;
571  apr_size_t len;
572 
573  if (APR_BUCKET_IS_EOS(bucket)) {
574  seen_eos = 1;
575  break;
576  }
577 
578  /* We can't do much with this. */
579  if (APR_BUCKET_IS_FLUSH(bucket)) {
580  continue;
581  }
582 
583  /* If the child stopped, we still must read to EOS. */
584  if (child_stopped_reading) {
585  continue;
586  }
587 
588  /* read */
589  rv = apr_bucket_read(bucket, &data, &len, APR_BLOCK_READ);
590  if (rv) {
591  return rv;
592  }
593 
594  if (logbufbytes && dbpos < logbufbytes) {
595  int cursize;
596 
597  if ((dbpos + len) > logbufbytes) {
598  cursize = logbufbytes - dbpos;
599  }
600  else {
601  cursize = len;
602  }
603  memcpy(logbuf + dbpos, data, cursize);
604  dbpos += cursize;
605  }
606 
607  /* Keep writing data to the child until done or too much time
608  * elapses with no progress or an error occurs.
609  */
610  rv = apr_file_write_full(script_out, data, len, NULL);
611 
612  if (rv != APR_SUCCESS) {
613  /* silly script stopped reading, soak up remaining message */
614  child_stopped_reading = 1;
615  ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r, APLOGNO(02651)
616  "Error writing request body to script %s",
617  r->filename);
618  }
619  }
621  }
622  while (!seen_eos);
623 
624  if (logbuf) {
625  logbuf[dbpos] = '\0';
626  }
627 
628  return APR_SUCCESS;
629 }
void ap_ssi_get_tag_and_value(include_ctx_t *ctx, char **tag, char **tag_val, int dodecode)
#define APR_STATUS_IS_EINTR(s)
Definition: apr_errno.h:1283
#define APR_WRITE
Definition: apr_file_io.h:121
size_t apr_size_t
Definition: apr.h:393
apr_status_t apr_ctime(char *date_str, apr_time_t t)
Definition: apr_buckets.h:59
Definition: apr_buckets.h:546
struct ap_conf_vector_t * module_config
Definition: httpd.h:1393
char * args
Definition: httpd.h:1041
request_rec * r
Definition: util_filter.h:294
#define APLOG_MARK
Definition: http_log.h:283
#define APLOG_ERR
Definition: http_log.h:46
apr_datatype_e desc_type
Definition: apr_poll.h:119
#define APR_BUCKET_INSERT_AFTER(a, b)
Definition: apr_buckets.h:414
Definition: apr_arch_file_io.h:107
Definition: apr_poll.h:103
server_rec * server
Definition: httpd.h:866
void * data
Definition: apr_buckets.h:244
int ap_scan_script_header_err_brigade_ex(request_rec *r, apr_bucket_brigade *bb, char *buffer, int module_index)
apr_off_t size
Definition: apr_file_info.h:198
The representation of a filter chain.
Definition: util_filter.h:278
apr_status_t apr_pollset_remove(apr_pollset_t *pollset, const apr_pollfd_t *descriptor)
void * ap_get_module_config(const ap_conf_vector_t *cv, const module *m)
struct apr_bucket_alloc_t apr_bucket_alloc_t
Definition: apr_buckets.h:123
apr_status_t ap_pass_brigade(ap_filter_t *filter, apr_bucket_brigade *bucket)
#define SSI_FLAG_PRINTING
Definition: mod_include.h:56
const char * method
Definition: httpd.h:915
conn_rec * connection
Definition: httpd.h:864
apr_bucket apr_bucket * apr_bucket_immortal_make(apr_bucket *b, const char *buf, apr_size_t nbyte) __attribute__((nonnull(1
#define HUGE_STRING_LEN
Definition: httpd.h:307
void * apr_palloc(apr_pool_t *p, apr_size_t size) __attribute__((nonnull(1)))
#define APR_STATUS_IS_TIMEUP(s)
Definition: apr_errno.h:540
#define APR_OPTIONAL_FN_TYPE(name)
Definition: apr_optional.h:42
#define APR_BUCKET_INIT(e)
Definition: apr_buckets.h:443
int flags
Definition: mod_include.h:77
APR Standard Headers Support.
struct ap_filter_t * proto_output_filters
Definition: httpd.h:1091
apr_bucket_brigade apr_status_t apr_brigade_destroy(apr_bucket_brigade *b) __attribute__((nonnull(1)))
void apr_table_unset(apr_table_t *t, const char *key)
apr_status_t apr_file_read(apr_file_t *thefile, void *buf, apr_size_t *nbytes)
#define APR_BUCKET_BUFF_SIZE
Definition: apr_buckets.h:54
void apr_bucket_destroy_noop(void *data)
apr_table_t * headers_out
Definition: httpd.h:993
Definition: apr_buckets.h:258
#define APR_POLLIN
Definition: apr_poll.h:49
#define apr_bucket_read(e, str, len, block)
Definition: apr_buckets.h:1122
apr_int64_t apr_interval_time_t
Definition: apr_time.h:55
APR Poll interface.
apr_int16_t reqevents
Definition: apr_poll.h:120
apr_status_t apr_bucket_copy_notimpl(apr_bucket *e, apr_bucket **c)
apr_size_t alloc_len
Definition: apr_buckets.h:554
apr_status_t apr_file_write_full(apr_file_t *thefile, const void *buf, apr_size_t nbytes, apr_size_t *bytes_written)
struct ap_filter_t * output_filters
Definition: httpd.h:1085
int int apr_status_t const char * desc
Definition: mod_dav.h:141
int method_number
Definition: httpd.h:913
Definition: util_filter.h:43
Definition: mod_include.h:69
Definition: util_filter.h:180
#define APR_BUCKET_IS_FLUSH(e)
Definition: apr_buckets.h:458
ap_filter_rec_t * frec
Definition: util_filter.h:282
apr_bucket_brigade * bb
Definition: mod_dav.h:555
#define APR_STATUS_IS_EOF(s)
Definition: apr_errno.h:573
apr_pool_t * p
Definition: apr_poll.h:118
#define APR_APPEND
Definition: apr_file_io.h:123
HTTP Daemon routines.
apr_descriptor desc
Definition: apr_poll.h:122
apr_status_t apr_brigade_cleanup(void *data) __attribute__((nonnull(1)))
apr_status_t apr_bucket_split_notimpl(apr_bucket *data, apr_size_t point)
#define MAX_STRING_LEN
Definition: httpd.h:304
apr_status_t ap_get_brigade(ap_filter_t *filter, apr_bucket_brigade *bucket, ap_input_mode_t mode, apr_read_type_e block, apr_off_t readbytes)
char * uri
Definition: httpd.h:1031
Definition: apr_poll.h:117
Definition: apr_buckets.h:224
dav_error * err
Definition: mod_dav.h:203
apr_pool_t * pool
Definition: httpd.h:862
apr_status_t apr_file_gets(char *str, int len, apr_file_t *thefile)
#define OK
Definition: httpd.h:460
APR-UTIL Buckets/Bucket Brigades.
Definition: apr_buckets.h:58
const char * apr_table_get(const apr_table_t *t, const char *key)
apr_file_t * f
Definition: apr_poll.h:109
ap_filter_type ftype
Definition: util_filter.h:254
int apr_file_printf(apr_file_t *fptr, const char *format,...) __attribute__((format(printf
APR Platform Definitions.
#define APLOG_WARNING
Definition: http_log.h:47
APR general purpose library routines.
#define APR_FINFO_SIZE
Definition: apr_file_info.h:149
#define APR_BUCKET_IS_EOS(e)
Definition: apr_buckets.h:464
#define SSI_CREATE_ERROR_BUCKET(ctx, f, bb)
Definition: mod_include.h:48
#define APR_RETRIEVE_OPTIONAL_FN(name)
Definition: apr_optional.h:84
#define APR_BUCKET_NEXT(e)
Definition: apr_buckets.h:425
int status
Definition: httpd.h:906
#define APLOG_MODULE_INDEX
Definition: http_log.h:168
#define HTTP_NOT_MODIFIED
Definition: httpd.h:511
void(* free)(void *e)
Definition: apr_buckets.h:252
apr_status_t apr_file_pipe_timeout_set(apr_file_t *thepipe, apr_interval_time_t timeout)
#define apr_bucket_delete(e)
Definition: apr_buckets.h:1049
unsigned argc
Definition: mod_include.h:89
apr_read_type_e
Definition: apr_buckets.h:57
apr_off_t start
Definition: apr_buckets.h:242
A structure that represents the current request.
Definition: httpd.h:860
void ap_log_rerror(const char *file, int line, int module_index, int level, apr_status_t status, const request_rec *r, const char *fmt,...)
#define HTTP_GATEWAY_TIME_OUT
Definition: httpd.h:548
Apache filter library.
void ap_register_include_handler(char *tag, include_handler_fn_t *func)
APR Strings library.
#define M_GET
Definition: httpd.h:601
#define HTTP_MOVED_TEMPORARILY
Definition: httpd.h:509
apr_status_t apr_file_close(apr_file_t *file)
#define SSI_EXPAND_DROP_NAME
Definition: mod_include.h:42
dav_buffer const char * str
Definition: mod_dav.h:464
#define SSI_VALUE_DECODED
Definition: mod_include.h:35
apr_time_t apr_time_now(void)
const char * protocol
Definition: httpd.h:894
void * client_data
Definition: apr_poll.h:123
int int const char dav_error * prev
Definition: mod_dav.h:170
#define APR_BRIGADE_FIRST(b)
Definition: apr_buckets.h:348
apr_status_t apr_pollset_create(apr_pollset_t **pollset, apr_uint32_t size, apr_pool_t *p, apr_uint32_t flags)
apr_table_t * headers_in
Definition: httpd.h:991
Definition: apr_buckets.h:131
#define APR_CTIME_LEN
Definition: apr_time.h:198
void ap_internal_redirect_handler(const char *new_uri, request_rec *r)
ap_filter_t * next
Definition: util_filter.h:288
int apr_status_t
Definition: apr_errno.h:44
request_rec * r
Definition: mod_dav.h:518
#define APR_EOF
Definition: apr_errno.h:467
const apr_bucket_type_t * type
Definition: apr_buckets.h:228
#define APR_EAGAIN
Definition: apr_errno.h:736
proxy_worker proxy_server_conf * conf
Definition: mod_proxy.h:636
apr_status_t apr_bucket_setaside_notimpl(apr_bucket *data, apr_pool_t *pool)
apr_status_t apr_pollset_add(apr_pollset_t *pollset, const apr_pollfd_t *descriptor)
#define APR_SUCCESS
Definition: apr_errno.h:225
#define APR_BRIGADE_SENTINEL(b)
Definition: apr_buckets.h:334
#define APLOGNO(n)
Definition: http_log.h:117
apr_status_t apr_stat(apr_finfo_t *finfo, const char *fname, apr_int32_t wanted, apr_pool_t *pool)
char * filename
Definition: httpd.h:1033
#define SSI_EXPAND_LEAVE_NAME
Definition: mod_include.h:41
apr_bucket apr_bucket apr_bucket apr_bucket apr_bucket apr_bucket * apr_bucket_heap_make(apr_bucket *b, const char *buf, apr_size_t nbyte, void(*free_func)(void *data)) __attribute__((nonnull(1
struct ap_filter_t * input_filters
Definition: httpd.h:1087
apr_status_t apr_file_open(apr_file_t **newf, const char *fname, apr_int32_t flag, apr_fileperms_t perm, apr_pool_t *pool)
unsigned aborted
Definition: httpd.h:1247
#define APR_OS_DEFAULT
Definition: apr_file_info.h:112
apr_bucket_alloc_t * list
Definition: apr_buckets.h:254
void apr_bucket_free(void *block) __attribute__((nonnull(1)))
Definition: apr_file_info.h:174
apr_status_t apr_pollset_poll(apr_pollset_t *pollset, apr_interval_time_t timeout, apr_int32_t *num, const apr_pollfd_t **descriptors)
void * apr_bucket_alloc(apr_size_t size, apr_bucket_alloc_t *list) __attribute__((nonnull(2)))
char * ap_ssi_parse_string(include_ctx_t *ctx, const char *in, char *out, apr_size_t length, int leave_name)
apr_size_t length
Definition: apr_buckets.h:234
#define APR_CREATE
Definition: apr_file_io.h:122
#define SSI_FLAG_NO_EXEC
Definition: mod_include.h:59
int apr_int32_t
Definition: apr.h:346
Definition: apr_arch_poll_private.h:119