summaryrefslogtreecommitdiff
path: root/modules/generators
diff options
context:
space:
mode:
authorJoe Orton <jorton@apache.org>2020-06-23 16:39:25 +0000
committerJoe Orton <jorton@apache.org>2020-06-23 16:39:25 +0000
commit279af56a53bc0e72cd74351ccb536a4f72e8b8a0 (patch)
treea3a79135ce30a838f8e6d71b1329a13b0b11dcc3 /modules/generators
parentaaf7e3eb4f21d3aec19381491470a5168a05904a (diff)
downloadhttpd-279af56a53bc0e72cd74351ccb536a4f72e8b8a0.tar.gz
* modules/generators/mod_cgid.c (cgid_handler): Bail immediately with
a 503 response on errors when talking to the daemon. Check the pid returned is not zero. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1879119 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'modules/generators')
-rw-r--r--modules/generators/mod_cgid.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/modules/generators/mod_cgid.c b/modules/generators/mod_cgid.c
index 0c50e0487c..3cde699215 100644
--- a/modules/generators/mod_cgid.c
+++ b/modules/generators/mod_cgid.c
@@ -1629,8 +1629,8 @@ static int cgid_handler(request_rec *r)
rv = send_req(sd, errpipe_out, r, argv0, env, CGI_REQ);
if (rv != APR_SUCCESS) {
- ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r, APLOGNO(01268)
- "write to cgi daemon process");
+ return log_scripterror(r, conf, HTTP_SERVICE_UNAVAILABLE, rv, APLOGNO(10245)
+ "could not send request to cgi daemon");
}
/* The write-end of the pipe is only used by the server, so close
@@ -1642,13 +1642,15 @@ static int cgid_handler(request_rec *r)
info->r = r;
rv = get_cgi_pid(r, conf, &(info->pid));
- if (APR_SUCCESS == rv){
+ /* Don't accept zero as a pid here, calling kill(0, SIGTERM) etc
+ * later is unpleasant. */
+ if (rv == APR_SUCCESS && info->pid) {
apr_pool_cleanup_register(r->pool, info,
- cleanup_script,
- apr_pool_cleanup_null);
+ cleanup_script, apr_pool_cleanup_null);
}
else {
- ap_log_rerror(APLOG_MARK, APLOG_DEBUG, rv, r, "error determining cgi PID");
+ return log_scripterror(r, conf, HTTP_SERVICE_UNAVAILABLE, rv, APLOGNO(10246)
+ "failed reading PID from cgi daemon");
}
/* We are putting the socket discriptor into an apr_file_t so that we can