Apache2
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,
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,
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) {
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) {
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) {
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,
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 
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  }
526 
527  /* Dunno about the reusability of the connection either, so don't */
529 
531  }
532 
533  /* don't soak up script output if errors occurred writing it
534  * out... otherwise, we prolong the life of the script when the
535  * connection drops or we stopped sending output for some other
536  * reason */
537  if (script_err && rv == APR_SUCCESS && !r->connection->aborted) {
538  apr_file_pipe_timeout_set(script_err, timeout);
539  log_script_err(r, script_err);
540  }
541 
542  if (script_err) apr_file_close(script_err);
543 
544  return OK; /* NOT r->status, even if it has changed. */
545 }
546 
547 /* Read the request body and write it to fd 'script_out', using 'bb'
548  * as temporary bucket brigade. If 'logbuf' is non-NULL, the first
549  * logbufbytes of stdout are stored in logbuf. */
550 static apr_status_t cgi_handle_request(request_rec *r, apr_file_t *script_out,
552  char *logbuf, apr_size_t logbufbytes)
553 {
554  int seen_eos = 0;
555  int child_stopped_reading = 0;
556  apr_status_t rv;
557  int dbpos = 0;
558 
559  do {
560  apr_bucket *bucket;
561 
564 
565  if (rv != APR_SUCCESS) {
566  return rv;
567  }
568 
569  for (bucket = APR_BRIGADE_FIRST(bb);
570  bucket != APR_BRIGADE_SENTINEL(bb);
571  bucket = APR_BUCKET_NEXT(bucket))
572  {
573  const char *data;
574  apr_size_t len;
575 
576  if (APR_BUCKET_IS_EOS(bucket)) {
577  seen_eos = 1;
578  break;
579  }
580 
581  /* We can't do much with this. */
582  if (APR_BUCKET_IS_FLUSH(bucket)) {
583  continue;
584  }
585 
586  /* If the child stopped, we still must read to EOS. */
587  if (child_stopped_reading) {
588  continue;
589  }
590 
591  /* read */
592  rv = apr_bucket_read(bucket, &data, &len, APR_BLOCK_READ);
593  if (rv) {
594  return rv;
595  }
596 
597  if (logbufbytes && dbpos < logbufbytes) {
598  int cursize;
599 
600  if ((dbpos + len) > logbufbytes) {
601  cursize = logbufbytes - dbpos;
602  }
603  else {
604  cursize = len;
605  }
606  memcpy(logbuf + dbpos, data, cursize);
607  dbpos += cursize;
608  }
609 
610  /* Keep writing data to the child until done or too much time
611  * elapses with no progress or an error occurs.
612  */
613  rv = apr_file_write_full(script_out, data, len, NULL);
614 
615  if (rv != APR_SUCCESS) {
616  /* silly script stopped reading, soak up remaining message */
617  child_stopped_reading = 1;
619  "Error writing request body to script %s",
620  r->filename);
621  }
622  }
624  }
625  while (!seen_eos);
626 
627  if (logbuf) {
628  logbuf[dbpos] = '\0';
629  }
630 
631  return APR_SUCCESS;
632 }
APR Platform Definitions.
APR-UTIL Buckets/Bucket Brigades.
APR general purpose library routines.
APR Poll interface.
APR Strings library.
APR Standard Headers Support.
void * ap_get_module_config(const ap_conf_vector_t *cv, const module *m)
#define HUGE_STRING_LEN
Definition: httpd.h:308
#define MAX_STRING_LEN
Definition: httpd.h:305
#define OK
Definition: httpd.h:461
apr_status_t ap_pass_brigade(ap_filter_t *filter, apr_bucket_brigade *bucket)
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)
@ AP_FTYPE_CONNECTION
Definition: util_filter.h:180
#define APLOGNO(n)
Definition: http_log.h:117
#define APLOG_ERR
Definition: http_log.h:46
#define APLOG_MARK
Definition: http_log.h:283
#define APLOG_WARNING
Definition: http_log.h:47
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 APLOG_MODULE_INDEX
Definition: http_log.h:168
void ap_internal_redirect_handler(const char *new_uri, request_rec *r)
int ap_scan_script_header_err_brigade_ex(request_rec *r, apr_bucket_brigade *bb, char *buffer, int module_index)
int status
Definition: httpd.h:902
ap_conn_keepalive_e keepalive
Definition: httpd.h:1261
char * uri
Definition: httpd.h:1027
struct ap_filter_t * output_filters
Definition: httpd.h:1081
int method_number
Definition: httpd.h:909
apr_pool_t * pool
Definition: httpd.h:858
char * filename
Definition: httpd.h:1029
conn_rec * connection
Definition: httpd.h:860
struct ap_filter_t * proto_output_filters
Definition: httpd.h:1087
struct ap_filter_t * input_filters
Definition: httpd.h:1083
apr_table_t * headers_in
Definition: httpd.h:987
struct ap_conf_vector_t * module_config
Definition: httpd.h:1405
const char * protocol
Definition: httpd.h:890
server_rec * server
Definition: httpd.h:862
const char * method
Definition: httpd.h:911
unsigned aborted
Definition: httpd.h:1257
char * args
Definition: httpd.h:1037
apr_table_t * headers_out
Definition: httpd.h:989
#define APR_EAGAIN
Definition: apr_errno.h:736
#define APR_EOF
Definition: apr_errno.h:467
#define APR_STATUS_IS_EINTR(s)
Definition: apr_errno.h:1295
#define APR_STATUS_IS_TIMEUP(s)
Definition: apr_errno.h:540
#define APR_STATUS_IS_EOF(s)
Definition: apr_errno.h:573
#define APR_BUCKET_INIT(e)
Definition: apr_buckets.h:448
void apr_bucket_destroy_noop(void *data)
#define APR_BUCKET_INSERT_AFTER(a, b)
Definition: apr_buckets.h:419
#define APR_BUCKET_IS_FLUSH(e)
Definition: apr_buckets.h:463
apr_status_t apr_bucket_split_notimpl(apr_bucket *data, apr_size_t point)
apr_status_t apr_bucket_copy_notimpl(apr_bucket *e, apr_bucket **c)
#define APR_BUCKET_NEXT(e)
Definition: apr_buckets.h:430
apr_read_type_e
Definition: apr_buckets.h:62
apr_bucket_brigade apr_status_t apr_brigade_destroy(apr_bucket_brigade *b) __attribute__((nonnull(1)))
#define APR_BUCKET_BUFF_SIZE
Definition: apr_buckets.h:54
#define APR_BRIGADE_SENTINEL(b)
Definition: apr_buckets.h:339
#define apr_bucket_delete(e)
Definition: apr_buckets.h:1086
#define APR_BUCKET_IS_EOS(e)
Definition: apr_buckets.h:469
void apr_bucket_free(void *block) __attribute__((nonnull(1)))
void * apr_bucket_alloc(apr_size_t size, apr_bucket_alloc_t *list) __attribute__((nonnull(2)))
struct apr_bucket_alloc_t apr_bucket_alloc_t
Definition: apr_buckets.h:128
#define APR_BRIGADE_FIRST(b)
Definition: apr_buckets.h:353
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
apr_bucket apr_bucket * apr_bucket_immortal_make(apr_bucket *b, const char *buf, apr_size_t nbyte) __attribute__((nonnull(1
apr_status_t apr_bucket_setaside_notimpl(apr_bucket *data, apr_pool_t *pool)
#define apr_bucket_read(e, str, len, block)
Definition: apr_buckets.h:1159
apr_status_t apr_brigade_cleanup(void *data) __attribute__((nonnull(1)))
@ APR_BLOCK_READ
Definition: apr_buckets.h:63
@ APR_NONBLOCK_READ
Definition: apr_buckets.h:64
#define APR_RETRIEVE_OPTIONAL_FN(name)
Definition: apr_optional.h:84
#define APR_OPTIONAL_FN_TYPE(name)
Definition: apr_optional.h:42
#define HTTP_NOT_MODIFIED
Definition: httpd.h:509
#define HTTP_MOVED_TEMPORARILY
Definition: httpd.h:507
#define HTTP_GATEWAY_TIME_OUT
Definition: httpd.h:546
int int apr_status_t const char * desc
Definition: mod_dav.h:143
request_rec * r
Definition: mod_dav.h:518
dav_buffer const char * str
Definition: mod_dav.h:465
apr_bucket_brigade * bb
Definition: mod_dav.h:555
const char * s
Definition: mod_dav.h:1327
int int const char dav_error * prev
Definition: mod_dav.h:171
dav_error * err
Definition: mod_dav.h:203
apr_bucket_brigade ap_input_mode_t apr_read_type_e block
Definition: mod_dav.h:2663
#define SSI_FLAG_PRINTING
Definition: mod_include.h:56
#define SSI_EXPAND_LEAVE_NAME
Definition: mod_include.h:41
void ap_register_include_handler(char *tag, include_handler_fn_t *func)
#define SSI_EXPAND_DROP_NAME
Definition: mod_include.h:42
char * ap_ssi_parse_string(include_ctx_t *ctx, const char *in, char *out, apr_size_t length, int leave_name)
#define SSI_CREATE_ERROR_BUCKET(ctx, f, bb)
Definition: mod_include.h:48
#define SSI_VALUE_DECODED
Definition: mod_include.h:35
void ap_ssi_get_tag_and_value(include_ctx_t *ctx, char **tag, char **tag_val, int dodecode)
#define SSI_FLAG_NO_EXEC
Definition: mod_include.h:59
proxy_worker proxy_server_conf * conf
Definition: mod_proxy.h:657
#define M_GET
Definition: httpd.h:599
@ AP_CONN_CLOSE
Definition: httpd.h:1183
#define APR_SUCCESS
Definition: apr_errno.h:225
int apr_status_t
Definition: apr_errno.h:44
apr_status_t apr_file_close(apr_file_t *file)
apr_status_t apr_file_write_full(apr_file_t *thefile, const void *buf, apr_size_t nbytes, apr_size_t *bytes_written)
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)
int apr_file_printf(apr_file_t *fptr, const char *format,...) __attribute__((format(printf
apr_status_t apr_file_read(apr_file_t *thefile, void *buf, apr_size_t *nbytes)
apr_status_t apr_file_pipe_timeout_set(apr_file_t *thepipe, apr_interval_time_t timeout)
apr_status_t apr_file_gets(char *str, int len, apr_file_t *thefile)
#define APR_APPEND
Definition: apr_file_io.h:103
#define APR_WRITE
Definition: apr_file_io.h:101
#define APR_CREATE
Definition: apr_file_io.h:102
#define APR_OS_DEFAULT
Definition: apr_file_info.h:112
#define APR_FINFO_SIZE
Definition: apr_file_info.h:149
apr_status_t apr_stat(apr_finfo_t *finfo, const char *fname, apr_int32_t wanted, apr_pool_t *pool)
int apr_int32_t
Definition: apr.h:347
size_t apr_size_t
Definition: apr.h:394
apr_status_t apr_pollset_remove(apr_pollset_t *pollset, const apr_pollfd_t *descriptor)
apr_status_t apr_pollset_create(apr_pollset_t **pollset, apr_uint32_t size, apr_pool_t *p, apr_uint32_t flags)
apr_status_t apr_pollset_add(apr_pollset_t *pollset, const apr_pollfd_t *descriptor)
apr_status_t apr_pollset_poll(apr_pollset_t *pollset, apr_interval_time_t timeout, apr_int32_t *num, const apr_pollfd_t **descriptors)
@ APR_POLL_FILE
Definition: apr_poll.h:95
void * apr_palloc(apr_pool_t *p, apr_size_t size) __attribute__((nonnull(1)))
const char * apr_table_get(const apr_table_t *t, const char *key)
void apr_table_unset(apr_table_t *t, const char *key)
#define APR_CTIME_LEN
Definition: apr_time.h:198
apr_int64_t apr_interval_time_t
Definition: apr_time.h:55
apr_time_t apr_time_now(void)
apr_status_t apr_ctime(char *date_str, apr_time_t t)
#define APR_POLLIN
Definition: apr_poll.h:49
HTTP Daemon routines.
ap_filter_type ftype
Definition: util_filter.h:254
The representation of a filter chain.
Definition: util_filter.h:278
request_rec * r
Definition: util_filter.h:294
ap_filter_rec_t * frec
Definition: util_filter.h:282
ap_filter_t * next
Definition: util_filter.h:288
Definition: apr_buckets.h:263
Definition: apr_buckets.h:551
apr_size_t alloc_len
Definition: apr_buckets.h:559
Definition: apr_buckets.h:136
Definition: apr_buckets.h:229
apr_size_t length
Definition: apr_buckets.h:239
void(* free)(void *e)
Definition: apr_buckets.h:257
apr_off_t start
Definition: apr_buckets.h:247
apr_bucket_alloc_t * list
Definition: apr_buckets.h:259
void * data
Definition: apr_buckets.h:249
const apr_bucket_type_t * type
Definition: apr_buckets.h:233
Definition: apr_arch_file_io.h:107
Definition: apr_file_info.h:174
apr_off_t size
Definition: apr_file_info.h:198
Definition: apr_poll.h:109
void * client_data
Definition: apr_poll.h:115
apr_int16_t reqevents
Definition: apr_poll.h:112
apr_datatype_e desc_type
Definition: apr_poll.h:111
apr_descriptor desc
Definition: apr_poll.h:114
apr_pool_t * p
Definition: apr_poll.h:110
Definition: apr_arch_poll_private.h:124
Definition: mod_include.h:69
int flags
Definition: mod_include.h:77
unsigned argc
Definition: mod_include.h:89
A structure that represents the current request.
Definition: httpd.h:856
apr_file_t * f
Definition: apr_poll.h:101
Apache filter library.
@ AP_MODE_READBYTES
Definition: util_filter.h:43