You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by ji...@apache.org on 2013/11/08 15:30:13 UTC

svn commit: r1540052 - in /httpd/httpd/trunk/modules/proxy: mod_proxy.c proxy_util.c

Author: jim
Date: Fri Nov  8 14:30:12 2013
New Revision: 1540052

URL: http://svn.apache.org/r1540052
Log:
UDS urls need to be desockified when configuring...

Modified:
    httpd/httpd/trunk/modules/proxy/mod_proxy.c
    httpd/httpd/trunk/modules/proxy/proxy_util.c

Modified: httpd/httpd/trunk/modules/proxy/mod_proxy.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/proxy/mod_proxy.c?rev=1540052&r1=1540051&r2=1540052&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/proxy/mod_proxy.c (original)
+++ httpd/httpd/trunk/modules/proxy/mod_proxy.c Fri Nov  8 14:30:12 2013
@@ -1335,7 +1335,6 @@ static void *merge_proxy_dir_config(apr_
     return new;
 }
 
-
 static const char *
     add_proxy(cmd_parms *cmd, void *dummy, const char *f1, const char *r1, int regex)
 {
@@ -1410,6 +1409,36 @@ static const char *
     return add_proxy(cmd, dummy, f1, r1, 1);
 }
 
+static char *de_socketfy(apr_pool_t *p, char *url)
+{
+    char *ptr;
+    /*
+     * We could be passed a URL during the config stage that contains
+     * the UDS path... ignore it
+     */
+    if (!strncasecmp(url, "unix:", 5) &&
+        ((ptr = ap_strchr(url, '|')) != NULL)) {
+        /* move past the 'unix:...|' UDS path info */
+        char *ret, *c;
+
+        ret = ptr + 1;
+        /* special case: "unix:....|scheme:" is OK, expand
+         * to "unix:....|scheme://localhost"
+         * */
+        c = ap_strchr(ret, ':');
+        if (c == NULL) {
+            return NULL;
+        }
+        if (c[1] == '\0') {
+            return apr_pstrcat(p, ret, "//localhost", NULL);
+        }
+        else {
+            return ret;
+        }
+    }
+    return url;
+}
+
 static const char *
     add_pass(cmd_parms *cmd, void *dummy, const char *arg, int is_regex)
 {
@@ -1501,7 +1530,7 @@ static const char *
     }
 
     new->fake = apr_pstrdup(cmd->pool, f);
-    new->real = apr_pstrdup(cmd->pool, r);
+    new->real = apr_pstrdup(cmd->pool, de_socketfy(cmd->pool, r));
     new->flags = flags;
     if (use_regex) {
         new->regex = ap_pregcomp(cmd->pool, f, AP_REG_EXTENDED);
@@ -1537,7 +1566,7 @@ static const char *
         new->balancer = balancer;
     }
     else {
-        proxy_worker *worker = ap_proxy_get_worker(cmd->temp_pool, NULL, conf, r);
+        proxy_worker *worker = ap_proxy_get_worker(cmd->temp_pool, NULL, conf, de_socketfy(cmd->pool, r));
         int reuse = 0;
         if (!worker) {
             const char *err = ap_proxy_define_worker(cmd->pool, &worker, NULL, conf, r, 0);
@@ -2013,7 +2042,7 @@ static const char *add_member(cmd_parms 
     }
 
     /* Try to find existing worker */
-    worker = ap_proxy_get_worker(cmd->temp_pool, balancer, conf, name);
+    worker = ap_proxy_get_worker(cmd->temp_pool, balancer, conf, de_socketfy(cmd->temp_pool, name));
     if (!worker) {
         ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, cmd->server, APLOGNO(01147)
                      "Defining worker '%s' for balancer '%s'",
@@ -2099,7 +2128,7 @@ static const char *
         }
     }
     else {
-        worker = ap_proxy_get_worker(cmd->temp_pool, NULL, conf, name);
+        worker = ap_proxy_get_worker(cmd->temp_pool, NULL, conf, de_socketfy(cmd->temp_pool, name));
         if (!worker) {
             if (in_proxy_section) {
                 err = ap_proxy_define_worker(cmd->pool, &worker, NULL,
@@ -2245,7 +2274,7 @@ static const char *proxysection(cmd_parm
         }
         else {
             worker = ap_proxy_get_worker(cmd->temp_pool, NULL, sconf,
-                                         conf->p);
+                                         de_socketfy(cmd->temp_pool, (char*)conf->p));
             if (!worker) {
                 err = ap_proxy_define_worker(cmd->pool, &worker, NULL,
                                           sconf, conf->p, 0);

Modified: httpd/httpd/trunk/modules/proxy/proxy_util.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/proxy/proxy_util.c?rev=1540052&r1=1540051&r2=1540052&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/proxy/proxy_util.c (original)
+++ httpd/httpd/trunk/modules/proxy/proxy_util.c Fri Nov  8 14:30:12 2013
@@ -1518,6 +1518,10 @@ PROXY_DECLARE(proxy_worker *) ap_proxy_g
     char *url_copy;
     int i;
 
+    if (!url) {
+        return NULL;
+    }
+
     c = ap_strchr_c(url, ':');
     if (c == NULL || c[1] != '/' || c[2] != '/' || c[3] == '\0') {
         return NULL;



Re: svn commit: r1540052 - in /httpd/httpd/trunk/modules/proxy: mod_proxy.c proxy_util.c

Posted by Eric Covener <co...@gmail.com>.
Seems to be a mix of this commit and 1609680

On Sun, Nov 23, 2014 at 7:47 PM, Eric Covener <co...@gmail.com> wrote:
> On Fri, Nov 8, 2013 at 9:30 AM,  <ji...@apache.org> wrote:
>>
>> URL: http://svn.apache.org/r1540052
>> Log:
>> UDS urls need to be desockified when configuring...
>>
>> Modified:
>>     httpd/httpd/trunk/modules/proxy/mod_proxy.c
>>     httpd/httpd/trunk/modules/proxy/proxy_util.c
>
>
> Caution: I don't know anything about UDS in mod_prox as user much less
> as a developer, but in my sandboxes with:
>
>   ProxyPassMatch ^/test.php$
> "unix:/var/run/php5-fpm.sock|fcgi://localhost/home/covener/SRC/httpd-trunk/built/htdocs/info.php"
>
> * 2.4 works
> * trunk w/o this patch works
> * trunk fails because it tries to actually connect to localhost:8000
> (fcgi:// default port)
>
> Is this commit broken or did it change the syntax?
>
> --
> Eric Covener
> covener@gmail.com



-- 
Eric Covener
covener@gmail.com

Re: svn commit: r1540052 - in /httpd/httpd/trunk/modules/proxy: mod_proxy.c proxy_util.c

Posted by Jim Jagielski <ji...@jaguNET.com>.
All this remind me to try to figure out a way to have the
perl test framework spin up some external scripts for
the websockets and httpd-on-uds tests... I've tried
to grok how it all works and spent 2 days on a bender. :)

Re: svn commit: r1540052 - in /httpd/httpd/trunk/modules/proxy: mod_proxy.c proxy_util.c

Posted by Jim Jagielski <ji...@jaguNET.com>.
Yeah, I think that's the issue.
> On Nov 24, 2014, at 7:57 AM, Eric Covener <co...@gmail.com> wrote:
> 
> On Mon, Nov 24, 2014 at 7:54 AM, Jim Jagielski <ji...@jagunet.com> wrote:
>> Hmmm.... let me try to recreate.
> 
> I am really confused about how it required both, but focused on the
> ematch thing and have a fix in for that.
> 
> -- 
> Eric Covener
> covener@gmail.com


Re: svn commit: r1540052 - in /httpd/httpd/trunk/modules/proxy: mod_proxy.c proxy_util.c

Posted by Eric Covener <co...@gmail.com>.
On Mon, Nov 24, 2014 at 7:54 AM, Jim Jagielski <ji...@jagunet.com> wrote:
> Hmmm.... let me try to recreate.

I am really confused about how it required both, but focused on the
ematch thing and have a fix in for that.

-- 
Eric Covener
covener@gmail.com

Re: svn commit: r1540052 - in /httpd/httpd/trunk/modules/proxy: mod_proxy.c proxy_util.c

Posted by Jim Jagielski <ji...@jaguNET.com>.
Hmmm.... let me try to recreate.

> On Nov 23, 2014, at 7:47 PM, Eric Covener <co...@gmail.com> wrote:
> 
> On Fri, Nov 8, 2013 at 9:30 AM,  <ji...@apache.org> wrote:
>> 
>> URL: http://svn.apache.org/r1540052
>> Log:
>> UDS urls need to be desockified when configuring...
>> 
>> Modified:
>>    httpd/httpd/trunk/modules/proxy/mod_proxy.c
>>    httpd/httpd/trunk/modules/proxy/proxy_util.c
> 
> 
> Caution: I don't know anything about UDS in mod_prox as user much less
> as a developer, but in my sandboxes with:
> 
>  ProxyPassMatch ^/test.php$
> "unix:/var/run/php5-fpm.sock|fcgi://localhost/home/covener/SRC/httpd-trunk/built/htdocs/info.php"
> 
> * 2.4 works
> * trunk w/o this patch works
> * trunk fails because it tries to actually connect to localhost:8000
> (fcgi:// default port)
> 
> Is this commit broken or did it change the syntax?
> 
> -- 
> Eric Covener
> covener@gmail.com


Re: svn commit: r1540052 - in /httpd/httpd/trunk/modules/proxy: mod_proxy.c proxy_util.c

Posted by Eric Covener <co...@gmail.com>.
On Fri, Nov 8, 2013 at 9:30 AM,  <ji...@apache.org> wrote:
>
> URL: http://svn.apache.org/r1540052
> Log:
> UDS urls need to be desockified when configuring...
>
> Modified:
>     httpd/httpd/trunk/modules/proxy/mod_proxy.c
>     httpd/httpd/trunk/modules/proxy/proxy_util.c


Caution: I don't know anything about UDS in mod_prox as user much less
as a developer, but in my sandboxes with:

  ProxyPassMatch ^/test.php$
"unix:/var/run/php5-fpm.sock|fcgi://localhost/home/covener/SRC/httpd-trunk/built/htdocs/info.php"

* 2.4 works
* trunk w/o this patch works
* trunk fails because it tries to actually connect to localhost:8000
(fcgi:// default port)

Is this commit broken or did it change the syntax?

-- 
Eric Covener
covener@gmail.com