summaryrefslogtreecommitdiff
path: root/modules/generators/mod_cgi.c
Commit message (Collapse)AuthorAgeFilesLines
* Further re-unification of code duplicated across mod_cgi/mod_cgid intoJoe Orton2020-09-081-169/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | cgi_common.h. Functional changes: - brings the PR 61980 fix to mod_cgid as well, and - some mod_cgid-specific APLOGNOs are dropped in favour of the code used in the equivalent error path in mod_cgi ... otherwise no user-visible changes (intended). * modules/generators/cgi_common.h (log_scripterror, log_script_err): Move here from mod_cgi. (cgi_handle_exec): Move here, renamed from mod_cgi's handle_exec. (cgi_optfns_retrieve): New function, split out from mod_cgi's cgi_post_config. * modules/generators/mod_cgid.c: Adjust accordingly, update to pass logno separately. (register_hooks): Register cgi_optfns_retrieve. * modules/generators/mod_cgi.c: Adjust accordingly. (register_hooks): Register cgi_optfns_retrieve. Github: closes #141 git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1881559 13f79535-47bb-0310-9956-ffa450edef68
* * modules/generators/cgi_common.h (cgi_handle_request): Factor outJoe Orton2020-02-251-78/+16
| | | | | | | | | | | | | near-identical common code from mod_cgid, mod_cgi. * modules/generators/mod_cgid.c (cgid_handler), modules/generators/mod_cgi.c (cgi_handler): Adjust to use cgi_handle_request. Github: closes #97 git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1874491 13f79535-47bb-0310-9956-ffa450edef68
* Fix build broken w/o --enable-cgid-fdpassing by r1867968:Joe Orton2019-10-041-1/+2
| | | | | | | | | | | | | | * modules/generators/cgi_common.h: Only define CGI bucket type if WANT_CGI_BUCKET is defined. * modules/generators/mod_cgi.c: Always include cgi_common.h, defining WANT_CGI_BUCKET iff APR_FILES_AS_SOCKETS is defined * modules/generators/mod_cgid.c: Always include cgi_common.h, defining WANT_CGI_BUCKET iff HAVE_CGID_FDPASSING (--enable-cgid-fdpassing). git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1867971 13f79535-47bb-0310-9956-ffa450edef68
* Move common (and near-identical) code for CGI response output handlingJoe Orton2019-10-041-126/+1
| | | | | | | | | | | | | | | | | | | | | | to cgi_common.h; the diff between the modules for this code was as follows: https://people.apache.org/~jorton/mod_cgi-to-cgid-handler.diff Change from previous: mod_cgi will now explicitly discard output when returning HTTP_MOVED_TEMPORARILY for relative redirects (should not be functionally different), TRACE1 logging of ap_pass_brigade failures for mod_cgid is dropped. * modules/generators/cgi_common.h (cgi_handle_response): New function, factored out from mod_cgid. (discard_script_output): Copied function from mod_cgi/d unchanged. * modules/generator/mod_cgid.c (cgid_handler), modules/generator/mod_cgi.c (cgi_handler): Use cgi_handle_response. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1867968 13f79535-47bb-0310-9956-ffa450edef68
* * modules/generators/cgi_common.h (cgi_bucket_create):Joe Orton2019-10-021-3/+0
| | | | | | | | | | | Disable APR timeout handling here for all callers. * modules/generators/mod_cgi.c (cgi_handler): ... drop it here. PR: 63797 git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1867882 13f79535-47bb-0310-9956-ffa450edef68
* mod_cgid: Continuation of r1862968, experimental fd passing support.Joe Orton2019-07-171-187/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1863191 13f79535-47bb-0310-9956-ffa450edef68
* PR62229: add CGIScriptTimeout to mod_cgiEric Covener2018-04-021-8/+40
| | | | | | | | | | | | | | | add CGIScriptTimeout to mod_cgi, like mod_cgid's CGIDScriptTimeout. Not addressed: making CGIScriptTimeout name work for either module. Submitted By: Hank Ibell <hwibell gmail.com> Committed By: covener git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1828172 13f79535-47bb-0310-9956-ffa450edef68
* PR 61980: AH01215 CGI stderr forwarding msg improvementEric Covener2018-01-101-3/+8
| | | | | | | | | | | | | | *) mod_cgi: Improve AH01215 messages to make it more clear that the message is the CGI scripts stderr output. PR 61980. [Hank Ibell <hwibell gmail.com>] Submitted By: Hank Ibell <hwibell gmail.com> Commited By: covener git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1820716 13f79535-47bb-0310-9956-ffa450edef68
* Follow up to r1739201.Yann Ylavic2016-10-281-5/+0
| | | | | | | These APR_TIMEUP special cases are now handled by ap_map_http_request_error(). git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1766998 13f79535-47bb-0310-9956-ffa450edef68
* mod_cgi/mod_cgid documentation about environment variables added (like ↵Luca Toscano2016-01-241-4/+4
| | | | | | | | | | DOCUMENT_ROOT). Bug: 58305 git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1726506 13f79535-47bb-0310-9956-ffa450edef68
* Added many log numbers to log statements thatRainer Jung2016-01-191-3/+6
| | | | | | | | | had none. Those were not detected by the coccinelle script. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1725485 13f79535-47bb-0310-9956-ffa450edef68
* Follow up to r1715880: revert more abusive ap_casecmpstr[n]() usages.Yann Ylavic2015-12-291-1/+1
| | | | git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1722150 13f79535-47bb-0310-9956-ffa450edef68
* Use new ap_casecmpstr[n]() functions where appropriate (not exhaustive).Yann Ylavic2015-11-231-1/+1
| | | | git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1715876 13f79535-47bb-0310-9956-ffa450edef68
* Revert r1715789: will re-commit without spurious functional changes.Yann Ylavic2015-11-231-1/+1
| | | | git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1715869 13f79535-47bb-0310-9956-ffa450edef68
* Use new ap_casecmpstr[n]() functions where appropriate (not exhaustive).Yann Ylavic2015-11-231-1/+1
| | | | | | | [Reverted by r1715869] git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1715789 13f79535-47bb-0310-9956-ffa450edef68
* core, modules: like r1657897 but for core and other modules than mod_proxy.Yann Ylavic2015-03-101-1/+1
| | | | | | | | | | | | | | More uses of ap_map_http_request_error() and AP_FILTER_ERROR so that we never return an HTTP error status from a handler if some filter generated a response already. That is, from a handler, either ap_get_brigade() (an input filter) returned AP_FILTER_ERROR and we must forward it to ap_die(), or ap_pass_brigade() (an output filter) failed with any status and we must return AP_FILTER_ERROR in any case for ap_die() to determine whether a response is needed or not. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1665625 13f79535-47bb-0310-9956-ffa450edef68
* mod_cgi: log cgi script stderr to ScriptLog, use APLOGNO for log_scripterrorJan Kaluža2014-09-231-9/+9
| | | | | | | errors. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1626978 13f79535-47bb-0310-9956-ffa450edef68
* Strip useless apr_brigade_cleanup() calls.Yann Ylavic2014-06-101-2/+0
| | | | git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1601624 13f79535-47bb-0310-9956-ffa450edef68
* core: Stop the HTTP_IN filter from attempting to write error bucketsGraham Leggett2013-05-141-1/+1
| | | | | | | | | to the output filters, which is bogus in the proxy case. Create a clean mapping from APR codes to HTTP status codes, and use it where needed. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1482522 13f79535-47bb-0310-9956-ffa450edef68
* Use %pm available since apr 1.3 instead of an extra call to apr_strerrorStefan Fritsch2013-03-311-3/+2
| | | | git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1463056 13f79535-47bb-0310-9956-ffa450edef68
* Replace an incorrect #if by the correct corresponding #if defined(...)Christophe Jaillet2012-11-111-1/+1
| | | | | | PR 54133 reported by Teodor Milkov () git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1407965 13f79535-47bb-0310-9956-ffa450edef68
* Code clean up (remove useless memory allocation) Stefan Fritsch2012-07-151-1/+1
| | | | | | | | Submitted by: Christophe JAILLET <christophe jaillet wanadoo fr> PR: 52648 git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1361803 13f79535-47bb-0310-9956-ffa450edef68
* Add lots of unique tags to error log messagesStefan Fritsch2011-12-021-17/+17
| | | | git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1209766 13f79535-47bb-0310-9956-ffa450edef68
* Remove more log message prefixes that are now redundant as theStefan Fritsch2011-11-291-3/+3
| | | | | | | the error log format includes the module name. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1208110 13f79535-47bb-0310-9956-ffa450edef68
* More cleanup: Expand tabs and some more indentation fixesStefan Fritsch2011-09-231-3/+3
| | | | | | | No functional change git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1174929 13f79535-47bb-0310-9956-ffa450edef68
* Cleanup effort in prep for GA push:Jim Jagielski2011-09-231-1/+1
| | | | | | | | Trim trailing whitespace... no func change git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1174751 13f79535-47bb-0310-9956-ffa450edef68
* PR51371: cross-compile issues with cgi and apr_procattr_limit_*.Eric Covener2011-09-171-6/+10
| | | | git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1172019 13f79535-47bb-0310-9956-ffa450edef68
* Add more (trace) logging to the ap_scan_script_header*() functionsStefan Fritsch2011-07-161-1/+3
| | | | | | | | | | Add ap_scan_script_header*_ex() functions that take a module index for logging. Make mod_cgi, mod_cgid, mod_proxy_fcgi, mod_proxy_scgi, mod_isapi use the new functions. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1147493 13f79535-47bb-0310-9956-ffa450edef68
* Introduce ap_(get|set)_core_module_config() functions/macros and use themStefan Fritsch2011-06-061-2/+1
| | | | | | | | | | | | everywhere. We know that the core module has module_index 0. Therefore we can save some pointer operations in ap_get_module_config(cv, &core_module) and ap_set_module_config(cv, &core_module, val). As these are called rather often, this may actually have some (small) measurable effect. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1132781 13f79535-47bb-0310-9956-ffa450edef68
* In comments: s@ XX @ XXX: @ so they can actually be found seen.Igor Galić2010-12-291-1/+1
| | | | git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1053668 13f79535-47bb-0310-9956-ffa450edef68
* Avoid unnecessariy initialisation before we test mod_cgi's handler name.Graham Leggett2010-10-191-2/+5
| | | | git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1024460 13f79535-47bb-0310-9956-ffa450edef68
* Intel's compiler warns about assigning the non-enum value 0 to the Jeff Trawick2010-08-061-1/+1
| | | | | | | | | | | | | | enumeration apr_finfo_t.filetype, which is done when forgetting the previously-derived file type use the appropriate enum value APR_NOFILE instead Also change comparisons of the field with 0 to use APR_NOFILE instead, as is the practice of some existing code. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@983065 13f79535-47bb-0310-9956-ffa450edef68
* Use the new APLOG_USE_MODULE/AP_DECLARE_MODULE macros everywhere to takeStefan Fritsch2010-06-061-1/+1
| | | | | | | advantage of per-module loglevels git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@951895 13f79535-47bb-0310-9956-ffa450edef68
* fix potential file descriptor leak with DEBUG_CGIStefan Fritsch2010-04-051-3/+1
| | | | git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@930955 13f79535-47bb-0310-9956-ffa450edef68
* Bring back OS/2 support.Brian Havard2009-08-261-0/+5
| | | | | | | Reverses r758929 with a little bit of conflict resolution. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@807930 13f79535-47bb-0310-9956-ffa450edef68
* * Do better checking of pollset operations in various places to avoid segfaults.Ruediger Pluem2009-08-161-3/+17
| | | | | | | | | PR: 46467 Submitted by: Stefan Fritsch <sf sfritsch.de> Reviewed by: rpluem git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@804764 13f79535-47bb-0310-9956-ffa450edef68
* remove OS/2 platform supportJeff Trawick2009-03-261-5/+0
| | | | git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@758929 13f79535-47bb-0310-9956-ffa450edef68
* Remove all references to CORE_PRIVATE.Paul Querna2008-04-071-2/+0
| | | | git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@645455 13f79535-47bb-0310-9956-ffa450edef68
* * Prevent running through the error stack by returning OK and setting r->statusRuediger Pluem2007-05-271-1/+28
| | | | | | | | accordingly if ret is HTTP_NOT_MODIFIED as this breaks mod_cache validating a stale entity. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@541990 13f79535-47bb-0310-9956-ffa450edef68
* PR#39710 - badly broken errordocuments for CGINick Kew2007-05-261-12/+1
| | | | | | | | | | We've just had another duplicate report of this on bugzilla. We've got a simple patch, and people asking WTF is going on with inaction. Noone seems clear on why the patch shouldn't be applied (http://marc.info/?l=apache-httpd-dev&m=117760311129386&w=2). git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@541926 13f79535-47bb-0310-9956-ffa450edef68
* Follow up to r451006, use APR_STATUS_IS_TIMEUP instead of comparing againstGarrett Rooney2006-09-291-1/+1
| | | | | | | | | | | | | | | APR_TIMEUP directly. Reported by: jorton * modules/generators/mod_cgi.c (cgi_handler): Use APR_STATUS_IS_TIMEUP. * modules/generators/mod_cgid.c (cgid_handler): Ditto. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@451289 13f79535-47bb-0310-9956-ffa450edef68
* * Notice that reading of the request entity body failed due to a timeoutRuediger Pluem2006-09-281-0/+5
| | | | git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@451006 13f79535-47bb-0310-9956-ffa450edef68
* PR 31759 (mutated) - reported by Jo RhettNick Kew2006-09-121-1/+3
| | | | | | | Don't return apr_status_t error value from input filter chain. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@442758 13f79535-47bb-0310-9956-ffa450edef68
* update license header textRoy T. Fielding2006-07-111-6/+6
| | | | git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@420983 13f79535-47bb-0310-9956-ffa450edef68
* Update the copyright year in all .c, .h and .xml filesColm MacCarthaigh2006-04-191-1/+1
| | | | git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@395228 13f79535-47bb-0310-9956-ffa450edef68
* No functional Change: Removing trailing whitespace. This alsoJim Jagielski2005-11-101-27/+27
| | | | | | | | means that "blank" lines consisting of just spaces or tabs are now really blank lines git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@332306 13f79535-47bb-0310-9956-ffa450edef68
* Remove CGI block on OPTIONS method so that scripts canRoy T. Fielding2005-10-181-7/+0
| | | | | | | | | | | respond to OPTIONS directly rather than via server default. PR: 15242 Reviewed-by: Paul Querna, Andre Malo, William A. Rowe, Jr. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@326255 13f79535-47bb-0310-9956-ffa450edef68
* Fix bug where non-200 CGI responses will not send anything down filter chain.Justin Erenkrantz2005-08-101-1/+12
| | | | | | | | | | | | This is most notable when mod_cache is used. This has been used in production on wiki.apache.org for a while now. * modules/generators/mod_cgi.c (cgi_handler): When a non-zero value is returned by scan_script, set the status field and ensure that we have an EOS to send down the filer stack. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@231167 13f79535-47bb-0310-9956-ffa450edef68
* * modules/generators/mod_cgi.c (cgi_bucket_read): Log a specific errorJoe Orton2005-06-081-1/+9
| | | | | | | | if a timeout occurs from a blocking read; more helpful than a generic "apr_bucket_read failed" error from some higher-up filter. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@189560 13f79535-47bb-0310-9956-ffa450edef68
* Update copyright year to 2005 and standardize on current copyright owner line.Justin Erenkrantz2005-02-041-1/+2
| | | | git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@151408 13f79535-47bb-0310-9956-ffa450edef68