| 1724 | } |
| 1725 | |
| 1726 | static int include_cmd(include_ctx_t *ctx, ap_filter_t *f, |
| 1727 | apr_bucket_brigade *bb, const char *command) |
| 1728 | { |
| 1729 | char **env; |
| 1730 | int sd; |
| 1731 | int retval; |
| 1732 | apr_file_t *tempsock = NULL; |
| 1733 | request_rec *r = f->r; |
| 1734 | cgid_server_conf *conf = ap_get_module_config(r->server->module_config, |
| 1735 | &cgid_module); |
| 1736 | cgid_dirconf *dc = ap_get_module_config(r->per_dir_config, &cgid_module); |
| 1737 | |
| 1738 | struct cleanup_script_info *info; |
| 1739 | apr_status_t rv; |
| 1740 | |
| 1741 | add_ssi_vars(r); |
| 1742 | env = ap_create_environment(r->pool, r->subprocess_env); |
| 1743 | |
| 1744 | if ((retval = connect_to_daemon(&sd, r, conf)) != OK) { |
| 1745 | return retval; |
| 1746 | } |
| 1747 | |
| 1748 | send_req(sd, NULL, r, command, env, SSI_REQ); |
| 1749 | |
| 1750 | info = apr_palloc(r->pool, sizeof(struct cleanup_script_info)); |
| 1751 | info->conf = conf; |
| 1752 | info->r = r; |
| 1753 | rv = get_cgi_pid(r, conf, &(info->pid)); |
| 1754 | if (APR_SUCCESS == rv) { |
| 1755 | /* for this type of request, the script is invoked through an |
| 1756 | * intermediate shell process... cleanup_script is only able |
| 1757 | * to knock out the shell process, not the actual script |
| 1758 | */ |
| 1759 | apr_pool_cleanup_register(r->pool, info, |
| 1760 | cleanup_script, |
| 1761 | apr_pool_cleanup_null); |
| 1762 | } |
| 1763 | else { |
| 1764 | ap_log_rerror(APLOG_MARK, APLOG_DEBUG, rv, r, "error determining cgi PID (for SSI)"); |
| 1765 | } |
| 1766 | |
| 1767 | apr_pool_cleanup_register(r->pool, info, |
| 1768 | cleanup_script, |
| 1769 | apr_pool_cleanup_null); |
| 1770 | |
| 1771 | /* We are putting the socket discriptor into an apr_file_t so that we can |
| 1772 | * use a pipe bucket to send the data to the client. APR will create |
| 1773 | * a cleanup for the apr_file_t which will close the socket, so we'll |
| 1774 | * get rid of the cleanup we registered when we created the socket. |
| 1775 | */ |
| 1776 | apr_os_pipe_put_ex(&tempsock, &sd, 1, r->pool); |
| 1777 | if (dc->timeout > 0) { |
| 1778 | apr_file_pipe_timeout_set(tempsock, dc->timeout); |
| 1779 | } |
| 1780 | else { |
| 1781 | apr_file_pipe_timeout_set(tempsock, r->server->timeout); |
| 1782 | } |
| 1783 |
nothing calls this directly
no test coverage detected