Changes with Apache 2.0.29-dev
+ *) Fix the cmd command for mod_include. When we are processing
+ a cmd command, we do not want to use the r->filename to set
+ the command name. The command comes from the SSI tag. To do this,
+ I added a variable to the function that builds the command line
+ in mod_cgi. This allows the include_cmd function to specify
+ the command line itself. [Ryan Bloom]
+
*) Change open_logs hook to return a value, allowing you
to flag a error while opening logs
[Ian Holsman, Doug MacEachern]
static apr_status_t ap_cgi_build_command(const char **cmd, const char ***argv,
- request_rec *r, apr_pool_t *p)
+ request_rec *r, apr_pool_t *p, int replace_cmd)
{
const char *ext = NULL;
const char *interpreter = NULL;
APR_DECLARE_OPTIONAL_FN(apr_status_t, ap_cgi_build_command,
(const char **cmd,
- const char ***argv, request_rec *r, apr_pool_t *p));
+ const char ***argv, request_rec *r, apr_pool_t *p, int replace_cmd));
static void register_hooks(apr_pool_t *p)
{
static apr_status_t default_build_command(const char **cmd, const char ***argv,
- request_rec *r, apr_pool_t *p)
+ request_rec *r, apr_pool_t *p,
+ int replace_cmd)
{
int numwords, x, idx;
char *w;
const char *args = r->args;
const char *argv0;
- /* Allow suexec's "/" check to succeed */
- if ((argv0 = strrchr(r->filename, '/')) != NULL)
- argv0++;
- else
- argv0 = r->filename;
- *cmd = argv0;
+ if (replace_cmd) {
+ /* Allow suexec's "/" check to succeed */
+ if ((argv0 = strrchr(r->filename, '/')) != NULL)
+ argv0++;
+ else
+ argv0 = r->filename;
+ *cmd = argv0;
+ }
if (!args || !args[0] || ap_strchr_c(args, '=')) {
numwords = 1;
numwords = APACHE_ARG_MAX - 1; /* Truncate args to prevent overrun */
}
*argv = apr_palloc(p, (numwords + 2) * sizeof(char *));
- (*argv)[0] = argv0;
+ (*argv)[0] = *cmd;
for (x = 1, idx = 1; x < numwords; x++) {
w = ap_getword_nulls(p, &args, '+');
ap_unescape_url(w);
ap_add_common_vars(r);
/* build the command line */
- if ((rv = cgi_build_command(&command, &argv, r, p)) != APR_SUCCESS) {
+ 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);
apr_bucket *b;
apr_status_t rv;
- if ((rv = cgi_build_command(&command, &argv, r, r->pool)) != APR_SUCCESS) {
+ 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);