Checkout
jorton
committed
on 17 Jul
mod_cgid: Continuation of r1862968, experimental fd passing support.

Split out CGI bucket implementation from mod_cgi and use in both
mod_c… Show more
mod_cgid: Continuation of r1862968, experimental fd passing support.

Split out CGI bucket implementation from mod_cgi and use in both

mod_cgi and mod_cgid, bringing stderr handling in mod_cgid up to par

with mod_cgi.  (There is a lot of code which has been copied between

mod_cgi{,d} so there's scope for further reduction of source

duplication between the modules using this header)

* modules/generators/cgi_common.h: Copied from mod_cgi.c, removed

 everything but the CGI bucket implementation with only one change:

 (struct cgi_bucket_data, cgi_bucket_create, cgi_bucket_read): Take a

 timeout on bucket creation, store and use on reads.

* modules/generators/mod_cgi.c [APR_FILES_AS_SOCKETS]: Include

 cgi_common.h.

 (cgi_handler): Pass configured timeout to CGI bucket.

* modules/generators/mod_cgid.c: Include cgi_common.h.

 (log_script_err): Copy from mod_cgi.c.

 (log_script): Use log_script_err.

 (send_req): Take fd for stderr.

 (cgid_child_errfn): Handle fd-passing case by writing error

 to stderr for client to pass through ap_log_rerror.

 (cgid_handler): Create pipe for stderr, pass write-end to

 server via send_req, use read-end to create CGI bucket.  Handle

 stderr output in failure paths.

PR: 54221

Show less