| 697 | } |
| 698 | |
| 699 | static apr_status_t include_cmd(include_ctx_t *ctx, ap_filter_t *f, |
| 700 | apr_bucket_brigade *bb, const char *command) |
| 701 | { |
| 702 | cgi_exec_info_t e_info; |
| 703 | const char **argv; |
| 704 | apr_file_t *script_out = NULL, *script_in = NULL, *script_err = NULL; |
| 705 | apr_status_t rv; |
| 706 | request_rec *r = f->r; |
| 707 | |
| 708 | add_ssi_vars(r); |
| 709 | |
| 710 | e_info.process_cgi = 0; |
| 711 | e_info.cmd_type = APR_SHELLCMD; |
| 712 | e_info.detached = 0; |
| 713 | e_info.in_pipe = APR_NO_PIPE; |
| 714 | e_info.out_pipe = APR_FULL_BLOCK; |
| 715 | e_info.err_pipe = APR_NO_PIPE; |
| 716 | e_info.prog_type = RUN_AS_SSI; |
| 717 | e_info.bb = &bb; |
| 718 | e_info.ctx = ctx; |
| 719 | e_info.next = f->next; |
| 720 | e_info.addrspace = 0; |
| 721 | |
| 722 | if ((rv = cgi_build_command(&command, &argv, r, r->pool, |
| 723 | &e_info)) != APR_SUCCESS) { |
| 724 | ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r, APLOGNO(01226) |
| 725 | "don't know how to spawn cmd child process: %s", |
| 726 | r->filename); |
| 727 | return rv; |
| 728 | } |
| 729 | |
| 730 | /* run the script in its own process */ |
| 731 | if ((rv = run_cgi_child(&script_out, &script_in, &script_err, |
| 732 | command, argv, r, r->pool, |
| 733 | &e_info)) != APR_SUCCESS) { |
| 734 | ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r, APLOGNO(01227) |
| 735 | "couldn't spawn child process: %s", r->filename); |
| 736 | return rv; |
| 737 | } |
| 738 | |
| 739 | APR_BRIGADE_INSERT_TAIL(bb, apr_bucket_pipe_create(script_in, |
| 740 | f->c->bucket_alloc)); |
| 741 | ctx->flush_now = 1; |
| 742 | |
| 743 | /* We can't close the pipe here, because we may return before the |
| 744 | * full CGI has been sent to the network. That's okay though, |
| 745 | * because we can rely on the pool to close the pipe for us. |
| 746 | */ |
| 747 | return APR_SUCCESS; |
| 748 | } |
| 749 | |
| 750 | static int cgi_post_config(apr_pool_t *p, apr_pool_t *plog, |
| 751 | apr_pool_t *ptemp, server_rec *s) |
no test coverage detected