From: Eric Covener Date: Fri, 22 Jan 2016 15:30:19 +0000 (+0000) Subject: from feedback, assume all parameters to SetHandler are expressions. X-Git-Tag: 2.5.0-alpha~2310 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=38a88646a94dc4345091c8f7a7455298eee4e0aa;p=thirdparty%2Fapache%2Fhttpd.git from feedback, assume all parameters to SetHandler are expressions. I couldnt come up with a plausible handler name that was an invalid expression. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1726233 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/docs/manual/mod/core.xml b/docs/manual/mod/core.xml index 1035178ce21..f768594f028 100644 --- a/docs/manual/mod/core.xml +++ b/docs/manual/mod/core.xml @@ -4318,7 +4318,7 @@ header SetHandler Forces all matching files to be processed by a handler -SetHandler handler-name|None|expr=expression +SetHandler handler-name|none|expression server configvirtual host directory.htaccess @@ -4365,7 +4365,7 @@ SetHandler imap-file <LocationMatch ^/app/(?<sub>[^/]+)/> - SetHandler "expr=proxy:unix:/var/run/app_%{env:MATCH_sub}.sock|fcgi://localhost:8080" + SetHandler "proxy:unix:/var/run/app_%{env:MATCH_sub}.sock|fcgi://localhost:8080" </FilesMatch> diff --git a/include/http_core.h b/include/http_core.h index eaff248575c..684fba49cfc 100644 --- a/include/http_core.h +++ b/include/http_core.h @@ -565,7 +565,7 @@ typedef struct { ap_regex_t *r; const char *mime_type; /* forced with ForceType */ - const char *handler; /* forced with SetHandler */ + const char *handler; /* forced by something other than SetHandler */ const char *output_filters; /* forced with SetOutputFilters */ const char *input_filters; /* forced with SetInputFilters */ int accept_path_info; /* forced with AcceptPathInfo */ @@ -646,7 +646,7 @@ typedef struct { apr_hash_t *response_code_exprs; unsigned int qualify_redirect_url :2; - ap_expr_info_t *expr_handler; /* forced with SetHandler expr= */ + ap_expr_info_t *expr_handler; /* forced with SetHandler */ } core_dir_config; /* macro to implement off by default behaviour */ diff --git a/server/core.c b/server/core.c index 5f276c4ca89..3b6eaebe6bc 100644 --- a/server/core.c +++ b/server/core.c @@ -1969,27 +1969,14 @@ static const char *set_sethandler(cmd_parms *cmd, const char *arg_) { core_dir_config *dirconf = d_; - - if (!strncmp(arg_, "expr=", 5)) { - const char *err; - dirconf->expr_handler = ap_expr_parse_cmd(cmd, arg_+5, + const char *err; + dirconf->expr_handler = ap_expr_parse_cmd(cmd, arg_, AP_EXPR_FLAG_STRING_RESULT, &err, NULL); - if (err) { - return apr_pstrcat(cmd->pool, - "Can't parse expression : ", err, NULL); - } - return NULL; - } - else if (arg_ == ap_strstr_c(arg_, "proxy:unix")) { - dirconf->handler = arg_; - } - else { - char *arg = apr_pstrdup(cmd->pool,arg_); - ap_str_tolower(arg); - dirconf->handler = arg; + if (err) { + return apr_pstrcat(cmd->pool, + "Can't parse expression : ", err, NULL); } - return NULL; } @@ -4668,7 +4655,13 @@ static int core_override_type(request_rec *r) return HTTP_INTERNAL_SERVER_ERROR; } if (strcmp(val, "none")) { - r->handler = apr_pstrdup(r->pool, val); + if (val != ap_strstr_c(val, "proxy:unix")) { + /* Retained for compatibility -- but not for UDS */ + char *tmp = apr_pstrdup(r->pool, val); + ap_str_tolower(tmp); + r->handler = tmp; + } + r->handler = val; } } else if (conf->handler && strcmp(conf->handler, "none")) {