You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by co...@apache.org on 2016/01/22 16:30:19 UTC

svn commit: r1726233 - in /httpd/httpd/trunk: docs/manual/mod/core.xml include/http_core.h server/core.c

Author: covener
Date: Fri Jan 22 15:30:19 2016
New Revision: 1726233

URL: http://svn.apache.org/viewvc?rev=1726233&view=rev
Log:
from feedback, assume all parameters to SetHandler are expressions.

I couldnt come up with a plausible handler name that was an 
invalid expression.

Modified:
    httpd/httpd/trunk/docs/manual/mod/core.xml
    httpd/httpd/trunk/include/http_core.h
    httpd/httpd/trunk/server/core.c

Modified: httpd/httpd/trunk/docs/manual/mod/core.xml
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/docs/manual/mod/core.xml?rev=1726233&r1=1726232&r2=1726233&view=diff
==============================================================================
--- httpd/httpd/trunk/docs/manual/mod/core.xml (original)
+++ httpd/httpd/trunk/docs/manual/mod/core.xml Fri Jan 22 15:30:19 2016
@@ -4318,7 +4318,7 @@ header</description>
 <name>SetHandler</name>
 <description>Forces all matching files to be processed by a
 handler</description>
-<syntax>SetHandler <var>handler-name</var>|None|expr=<var>expression</var></syntax>
+<syntax>SetHandler <var>handler-name</var>|none|<var>expression</var></syntax>
 <contextlist><context>server config</context><context>virtual host</context>
 <context>directory</context><context>.htaccess</context>
 </contextlist>
@@ -4365,7 +4365,7 @@ SetHandler imap-file
 
     <highlight language="config">
 &lt;LocationMatch ^/app/(?&lt;sub&gt;[^/]+)/&gt;
-     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"
 &lt;/FilesMatch&gt;
     </highlight>
 

Modified: httpd/httpd/trunk/include/http_core.h
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/include/http_core.h?rev=1726233&r1=1726232&r2=1726233&view=diff
==============================================================================
--- httpd/httpd/trunk/include/http_core.h (original)
+++ httpd/httpd/trunk/include/http_core.h Fri Jan 22 15:30:19 2016
@@ -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 */

Modified: httpd/httpd/trunk/server/core.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/core.c?rev=1726233&r1=1726232&r2=1726233&view=diff
==============================================================================
--- httpd/httpd/trunk/server/core.c (original)
+++ httpd/httpd/trunk/server/core.c Fri Jan 22 15:30:19 2016
@@ -1969,27 +1969,14 @@ static const char *set_sethandler(cmd_pa
                                      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_re
             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")) { 



Re: svn commit: r1726233 - in /httpd/httpd/trunk: docs/manual/mod/core.xml include/http_core.h server/core.c

Posted by Yann Ylavic <yl...@gmail.com>.
On Fri, Jan 22, 2016 at 4:30 PM,  <co...@apache.org> wrote:
> Author: covener
> Date: Fri Jan 22 15:30:19 2016
> New Revision: 1726233
>
> URL: http://svn.apache.org/viewvc?rev=1726233&view=rev
> Log:
> from feedback, assume all parameters to SetHandler are expressions.
>
> Modified:
>     httpd/httpd/trunk/server/core.c
>
[]
> Modified: httpd/httpd/trunk/server/core.c
> URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/core.c?rev=1726233&r1=1726232&r2=1726233&view=diff
> ==============================================================================
> --- httpd/httpd/trunk/server/core.c (original)
> +++ httpd/httpd/trunk/server/core.c Fri Jan 22 15:30:19 2016
[]
> @@ -4668,7 +4655,13 @@ static int core_override_type(request_re
>              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;

Missing an "else"?

>          }
>      }
>      else if (conf->handler && strcmp(conf->handler, "none")) {
>
>