You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by wr...@apache.org on 2002/04/13 21:50:47 UTC
cvs commit: httpd-2.0/modules/generators mod_cgi.c mod_cgi.h
wrowe 02/04/13 12:50:46
Modified: modules/arch/win32 mod_win32.c
modules/generators mod_cgi.c mod_cgi.h
Log:
In order for Win32 to accept the shebang line of #!perl so we 1) search
the PATH and 2) resolve perl.exe for perl, we must add the progtype so
we can override APR_PROGRAM with APR_PROGRAM_PATH. This is the API change
only for the cgi build command line option function.
Revision Changes Path
1.12 +5 -3 httpd-2.0/modules/arch/win32/mod_win32.c
Index: mod_win32.c
===================================================================
RCS file: /home/cvs/httpd-2.0/modules/arch/win32/mod_win32.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- mod_win32.c 12 Apr 2002 06:35:15 -0000 1.11
+++ mod_win32.c 13 Apr 2002 19:50:46 -0000 1.12
@@ -412,7 +412,8 @@
static apr_status_t ap_cgi_build_command(const char **cmd, const char ***argv,
- request_rec *r, apr_pool_t *p, int replace_cmd)
+ request_rec *r, apr_pool_t *p,
+ int replace_cmd, apr_cmdtype_e *type)
{
const char *ext = NULL;
const char *interpreter = NULL;
@@ -525,8 +526,9 @@
}
APR_DECLARE_OPTIONAL_FN(apr_status_t, ap_cgi_build_command,
- (const char **cmd,
- const char ***argv, request_rec *r, apr_pool_t *p, int replace_cmd));
+ (const char **cmd, const char ***argv,
+ request_rec *r, apr_pool_t *p,
+ int replace_cmd, apr_cmdtype_e *type));
static void register_hooks(apr_pool_t *p)
{
1.131 +18 -16 httpd-2.0/modules/generators/mod_cgi.c
Index: mod_cgi.c
===================================================================
RCS file: /home/cvs/httpd-2.0/modules/generators/mod_cgi.c,v
retrieving revision 1.130
retrieving revision 1.131
diff -u -r1.130 -r1.131
--- mod_cgi.c 30 Mar 2002 23:11:55 -0000 1.130
+++ mod_cgi.c 13 Apr 2002 19:50:46 -0000 1.131
@@ -510,7 +510,7 @@
static apr_status_t default_build_command(const char **cmd, const char ***argv,
request_rec *r, apr_pool_t *p,
- int replace_cmd)
+ int replace_cmd, apr_cmdtype_e * type)
{
int numwords, x, idx;
char *w;
@@ -638,14 +638,6 @@
ap_add_common_vars(r);
- /* build the command line */
- if ((rv = cgi_build_command(&command, &argv, r, p, 1)) != APR_SUCCESS) {
- ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r,
- "don't know how to spawn child process: %s",
- r->filename);
- return HTTP_INTERNAL_SERVER_ERROR;
- }
-
e_info.cmd_type = APR_PROGRAM;
e_info.in_pipe = APR_CHILD_BLOCK;
e_info.out_pipe = APR_CHILD_BLOCK;
@@ -655,6 +647,15 @@
e_info.ctx = NULL;
e_info.next = NULL;
+ /* build the command line */
+ if ((rv = cgi_build_command(&command, &argv, r, p, 1, &e_info.cmd_type))
+ != APR_SUCCESS) {
+ ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r,
+ "don't know how to spawn child process: %s",
+ r->filename);
+ return HTTP_INTERNAL_SERVER_ERROR;
+ }
+
/* run the script in its own process */
if ((rv = run_cgi_child(&script_out, &script_in, &script_err,
command, argv, r, p, &e_info)) != APR_SUCCESS) {
@@ -886,13 +887,6 @@
apr_bucket *b;
apr_status_t rv;
- if ((rv = cgi_build_command(&command, &argv, r, r->pool, 0)) != APR_SUCCESS) {
- ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r,
- "don't know how to spawn cmd child process: %s",
- r->filename);
- return HTTP_INTERNAL_SERVER_ERROR;
- }
-
e_info.cmd_type = APR_SHELLCMD;
e_info.in_pipe = APR_NO_PIPE;
e_info.out_pipe = APR_FULL_BLOCK;
@@ -901,6 +895,14 @@
e_info.bb = bb;
e_info.ctx = ctx;
e_info.next = f->next;
+
+ if ((rv = cgi_build_command(&command, &argv, r, r->pool, 0, &e_info.cmd_type))
+ != APR_SUCCESS) {
+ ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r,
+ "don't know how to spawn cmd child process: %s",
+ r->filename);
+ return HTTP_INTERNAL_SERVER_ERROR;
+ }
/* run the script in its own process */
if ((rv = run_cgi_child(&script_out, &script_in, &script_err,
1.5 +6 -1 httpd-2.0/modules/generators/mod_cgi.h
Index: mod_cgi.h
===================================================================
RCS file: /home/cvs/httpd-2.0/modules/generators/mod_cgi.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- mod_cgi.h 13 Mar 2002 20:47:48 -0000 1.4
+++ mod_cgi.h 13 Apr 2002 19:50:46 -0000 1.5
@@ -67,12 +67,17 @@
* @param argv Pointer to the arguments to pass (may be overridden)
* @param r The current request
* @param p The pool to allocate correct cmd/argv elements within.
+ * @param replace_cmd Set true if r->filename is valid and may
+ * replace argv[0] and cmd, otherwise false
+ * @param type Set to APR_SHELLCMD or APR_PROGRAM on entry, may be
+ * changed to invoke the program with alternate semantics.
* @remark This callback may be registered by the os-specific module
* to correct the command and arguments for apr_proc_create invocation
* on a given os. mod_cgi will call the function if registered.
*/
APR_DECLARE_OPTIONAL_FN(apr_status_t, ap_cgi_build_command,
(const char **cmd, const char ***argv,
- request_rec *r, apr_pool_t *p, int replace_cmd));
+ request_rec *r, apr_pool_t *p,
+ int replace_cmd, apr_cmdtype_e *type));
#endif /* _MOD_CGI_H */