Re: svn commit: r1609680 - in /httpd/httpd/trunk/modules/proxy: mod_proxy.c mod_proxy.h proxy_util.c
+1 > On Nov 27, 2014, at 11:51 AM, Yann Ylavic wrote: > > On Thu, Nov 27, 2014 at 12:36 PM, Jan Kaluža wrote: >> On 11/24/2014 01:37 PM, Eric Covener wrote: >>> >>> please check r1641381 >> >> >> Anyone against proposing r1609680 (commit from the subject) + r1641381 for >> 2.4.x? > > +1 > > Thanks, > Yann.
Re: svn commit: r1609680 - in /httpd/httpd/trunk/modules/proxy: mod_proxy.c mod_proxy.h proxy_util.c
On Thu, Nov 27, 2014 at 12:36 PM, Jan Kaluža wrote: > On 11/24/2014 01:37 PM, Eric Covener wrote: >> >> please check r1641381 > > > Anyone against proposing r1609680 (commit from the subject) + r1641381 for > 2.4.x? +1 Thanks, Yann.
Re: svn commit: r1609680 - in /httpd/httpd/trunk/modules/proxy: mod_proxy.c mod_proxy.h proxy_util.c
On 11/24/2014 01:37 PM, Eric Covener wrote: please check r1641381 Anyone against proposing r1609680 (commit from the subject) + r1641381 for 2.4.x? Regards, Jan Kaluza On Sun, Nov 23, 2014 at 9:59 PM, Eric Covener wrote: On Sun, Nov 23, 2014 at 9:57 PM, Eric Covener wrote: On Fri, Jul 11, 2014 at 6:36 AM, wrote: static int ap_proxy_strcmp_ematch(const char *str, const char *expected) +{ +apr_size_t x, y; + +for (x = 0, y = 0; expected[y]; ++y, ++x) { +if ((!str[x]) && (expected[y] != ' || !apr_isdigit(expected[y + 1]))) +return -1; +if (expected[y] == ' && apr_isdigit(expected[y + 1])) { +while (expected[y] == ' && apr_isdigit(expected[y + 1])) +y += 2; +if (!expected[y]) +return 0; +while (str[x]) { +int ret; +if ((ret = ap_proxy_strcmp_ematch(&str[x++], &expected[y])) != 1) +return ret; +} +return -1; +} +else if (expected[y] == '\\') { +/* NUL is an invalid char! */ +if (!expected[++y]) +return -2; +} +if (str[x] != expected[y]) +return 1; +} +return (str[x] != '\0'); +} Sorry, stray keystroke (tab?) made gmail send early. This is breaking the common PHP-FPM recipes using unix domain sockets in trunk e.g. ProxyPassMatch ^/info.php$ "unix:/var/run/php5-fpm.sock|fcgi://localhost/home/covener/SRC/httpd-trunk/built/htdocs/" The old test accepted the worker URL being a prefix of the worker: strncmp(url_copy, worker->s->name, worker_name_length) == 0) but now that doesn't happen for ProxyPassMatch. This seems to be due to the last return expecting str[x] to have been totally consumed by the expected (worker) string. -- Eric Covener cove...@gmail.com
Re: svn commit: r1609680 - in /httpd/httpd/trunk/modules/proxy: mod_proxy.c mod_proxy.h proxy_util.c
On 11/24/2014 03:59 AM, Eric Covener wrote: On Sun, Nov 23, 2014 at 9:57 PM, Eric Covener wrote: On Fri, Jul 11, 2014 at 6:36 AM, wrote: static int ap_proxy_strcmp_ematch(const char *str, const char *expected) +{ +apr_size_t x, y; + +for (x = 0, y = 0; expected[y]; ++y, ++x) { +if ((!str[x]) && (expected[y] != ' || !apr_isdigit(expected[y + 1]))) +return -1; +if (expected[y] == ' && apr_isdigit(expected[y + 1])) { +while (expected[y] == ' && apr_isdigit(expected[y + 1])) +y += 2; +if (!expected[y]) +return 0; +while (str[x]) { +int ret; +if ((ret = ap_proxy_strcmp_ematch(&str[x++], &expected[y])) != 1) +return ret; +} +return -1; +} +else if (expected[y] == '\\') { +/* NUL is an invalid char! */ +if (!expected[++y]) +return -2; +} +if (str[x] != expected[y]) +return 1; +} +return (str[x] != '\0'); +} Sorry, stray keystroke (tab?) made gmail send early. This is breaking the common PHP-FPM recipes using unix domain sockets in trunk e.g. ProxyPassMatch ^/info.php$ "unix:/var/run/php5-fpm.sock|fcgi://localhost/home/covener/SRC/httpd-trunk/built/htdocs/" The old test accepted the worker URL being a prefix of the worker: strncmp(url_copy, worker->s->name, worker_name_length) == 0) but now that doesn't happen for ProxyPassMatch. This seems to be due to the last return expecting str[x] to have been totally consumed by the expected (worker) string. Conflict discovered in file 'proxy/proxy_util.c'. ^ You were faster, thanks for fixing this issue :). Regards, Jan Kaluza
Re: svn commit: r1609680 - in /httpd/httpd/trunk/modules/proxy: mod_proxy.c mod_proxy.h proxy_util.c
please check r1641381 On Sun, Nov 23, 2014 at 9:59 PM, Eric Covener wrote: > On Sun, Nov 23, 2014 at 9:57 PM, Eric Covener wrote: >> On Fri, Jul 11, 2014 at 6:36 AM, wrote: >>> static int ap_proxy_strcmp_ematch(const char *str, const char *expected) >>> +{ >>> +apr_size_t x, y; >>> + >>> +for (x = 0, y = 0; expected[y]; ++y, ++x) { >>> +if ((!str[x]) && (expected[y] != ' >>> || !apr_isdigit(expected[y + 1]))) >>> +return -1; >>> +if (expected[y] == ' && apr_isdigit(expected[y + 1])) { >>> +while (expected[y] == ' && apr_isdigit(expected[y + 1])) >>> +y += 2; >>> +if (!expected[y]) >>> +return 0; >>> +while (str[x]) { >>> +int ret; >>> +if ((ret = ap_proxy_strcmp_ematch(&str[x++], >>> &expected[y])) != 1) >>> +return ret; >>> +} >>> +return -1; >>> +} >>> +else if (expected[y] == '\\') { >>> +/* NUL is an invalid char! */ >>> +if (!expected[++y]) >>> +return -2; >>> +} >>> +if (str[x] != expected[y]) >>> +return 1; >>> +} >>> +return (str[x] != '\0'); >>> +} >> > > Sorry, stray keystroke (tab?) made gmail send early. > > This is breaking the common PHP-FPM recipes using unix domain sockets > in trunk e.g. > > ProxyPassMatch ^/info.php$ > "unix:/var/run/php5-fpm.sock|fcgi://localhost/home/covener/SRC/httpd-trunk/built/htdocs/" > > The old test accepted the worker URL being a prefix of the worker: > > strncmp(url_copy, worker->s->name, worker_name_length) == 0) > > but now that doesn't happen for ProxyPassMatch. This seems to be > due to the last return expecting str[x] to have been totally consumed > by the expected (worker) string. > > > -- > Eric Covener > cove...@gmail.com -- Eric Covener cove...@gmail.com
Re: svn commit: r1609680 - in /httpd/httpd/trunk/modules/proxy: mod_proxy.c mod_proxy.h proxy_util.c
On Sun, Nov 23, 2014 at 9:57 PM, Eric Covener wrote: > On Fri, Jul 11, 2014 at 6:36 AM, wrote: >> static int ap_proxy_strcmp_ematch(const char *str, const char *expected) >> +{ >> +apr_size_t x, y; >> + >> +for (x = 0, y = 0; expected[y]; ++y, ++x) { >> +if ((!str[x]) && (expected[y] != ' >> || !apr_isdigit(expected[y + 1]))) >> +return -1; >> +if (expected[y] == ' && apr_isdigit(expected[y + 1])) { >> +while (expected[y] == ' && apr_isdigit(expected[y + 1])) >> +y += 2; >> +if (!expected[y]) >> +return 0; >> +while (str[x]) { >> +int ret; >> +if ((ret = ap_proxy_strcmp_ematch(&str[x++], &expected[y])) >> != 1) >> +return ret; >> +} >> +return -1; >> +} >> +else if (expected[y] == '\\') { >> +/* NUL is an invalid char! */ >> +if (!expected[++y]) >> +return -2; >> +} >> +if (str[x] != expected[y]) >> +return 1; >> +} >> +return (str[x] != '\0'); >> +} > Sorry, stray keystroke (tab?) made gmail send early. This is breaking the common PHP-FPM recipes using unix domain sockets in trunk e.g. ProxyPassMatch ^/info.php$ "unix:/var/run/php5-fpm.sock|fcgi://localhost/home/covener/SRC/httpd-trunk/built/htdocs/" The old test accepted the worker URL being a prefix of the worker: strncmp(url_copy, worker->s->name, worker_name_length) == 0) but now that doesn't happen for ProxyPassMatch. This seems to be due to the last return expecting str[x] to have been totally consumed by the expected (worker) string. -- Eric Covener cove...@gmail.com
Re: svn commit: r1609680 - in /httpd/httpd/trunk/modules/proxy: mod_proxy.c mod_proxy.h proxy_util.c
On Fri, Jul 11, 2014 at 6:36 AM, wrote: > static int ap_proxy_strcmp_ematch(const char *str, const char *expected) > +{ > +apr_size_t x, y; > + > +for (x = 0, y = 0; expected[y]; ++y, ++x) { > +if ((!str[x]) && (expected[y] != ' > || !apr_isdigit(expected[y + 1]))) > +return -1; > +if (expected[y] == ' && apr_isdigit(expected[y + 1])) { > +while (expected[y] == ' && apr_isdigit(expected[y + 1])) > +y += 2; > +if (!expected[y]) > +return 0; > +while (str[x]) { > +int ret; > +if ((ret = ap_proxy_strcmp_ematch(&str[x++], &expected[y])) > != 1) > +return ret; > +} > +return -1; > +} > +else if (expected[y] == '\\') { > +/* NUL is an invalid char! */ > +if (!expected[++y]) > +return -2; > +} > +if (str[x] != expected[y]) > +return 1; > +} > +return (str[x] != '\0'); > +} This is breaking the common PHP-FPM recipes using unix domain sockets in trunk e.g. ProxyPassMatch ^/info.php$ "unix:/var/run/php5-fpm.sock|fcgi://localhost/home/covener/SRC/httpd-trunk/built/htdocs/" The old test accepted the worker URL being a prefix of the worker: (, but now that doesn't happen for ProxyPassMatch. This seems to be due to the last return. -- Eric Covener cove...@gmail.com
Re: svn commit: r1609680 - in /httpd/httpd/trunk/modules/proxy: mod_proxy.c mod_proxy.h proxy_util.c
On 07/11/2014 01:38 PM, Jim Jagielski wrote: On Jul 11, 2014, at 6:36 AM, jkal...@apache.org wrote: Author: jkaluza Date: Fri Jul 11 10:36:15 2014 New Revision: 1609680 URL: http://svn.apache.org/r1609680 Log: mod_proxy: add ap_proxy_define_match_worker() and use it for ProxyPassMatch and ProxyMatch section to distinguish between normal workers and workers with regex substitutions in the name. Implement handling of such workers in ap_proxy_get_worker(). PR 43513 Modified: httpd/httpd/trunk/modules/proxy/mod_proxy.c httpd/httpd/trunk/modules/proxy/mod_proxy.h 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=1609680&r1=1609679&r2=1609680&view=diff == --- httpd/httpd/trunk/modules/proxy/mod_proxy.c (original) +++ httpd/httpd/trunk/modules/proxy/mod_proxy.c Fri Jul 11 10:36:15 2014 @@ -1647,15 +1647,30 @@ static const char * new->balancer = balancer; } else { -proxy_worker *worker = ap_proxy_get_worker(cmd->temp_pool, NULL, conf, de_socketfy(cmd->pool, r)); +proxy_worker *worker = ap_proxy_get_worker(cmd->temp_pool, NULL, conf, new->real); Why do we no longer de_socketfy? Looks like this breaks UDS. This should be ok, because new->real is already de_socketfy-ied (see line 1601) http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/proxy/mod_proxy.c?revision=1609688&view=markup#l1601 int reuse = 0; if (!worker) { -const char *err = ap_proxy_define_worker(cmd->pool, &worker, NULL, conf, r, 0); +const char *err; +if (use_regex) { +err = ap_proxy_define_match_worker(cmd->pool, &worker, NULL, + conf, r, 0); +} +else { +err = ap_proxy_define_worker(cmd->pool, &worker, NULL, + conf, r, 0); +} if (err) return apr_pstrcat(cmd->temp_pool, "ProxyPass ", err, NULL); PROXY_COPY_CONF_PARAMS(worker, conf); -} else { +} +else if ((use_regex != 0) ^ (worker->s->is_name_matchable)) { Minor nit: I always disliked using bitwise xor for boolean xor :/ That's from Yann's part of the patch, but I can change it if needed. We need an mmn bump. Will do it in next commit. Regards, Jan Kaluza
Re: svn commit: r1609680 - in /httpd/httpd/trunk/modules/proxy: mod_proxy.c mod_proxy.h proxy_util.c
On Jul 11, 2014, at 6:36 AM, jkal...@apache.org wrote: > Author: jkaluza > Date: Fri Jul 11 10:36:15 2014 > New Revision: 1609680 > > URL: http://svn.apache.org/r1609680 > Log: > mod_proxy: add ap_proxy_define_match_worker() and use it for ProxyPassMatch > and ProxyMatch section to distinguish between normal workers and workers > with regex substitutions in the name. Implement handling of such workers > in ap_proxy_get_worker(). PR 43513 > > Modified: >httpd/httpd/trunk/modules/proxy/mod_proxy.c >httpd/httpd/trunk/modules/proxy/mod_proxy.h >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=1609680&r1=1609679&r2=1609680&view=diff > == > --- httpd/httpd/trunk/modules/proxy/mod_proxy.c (original) > +++ httpd/httpd/trunk/modules/proxy/mod_proxy.c Fri Jul 11 10:36:15 2014 > @@ -1647,15 +1647,30 @@ static const char * > new->balancer = balancer; > } > else { > -proxy_worker *worker = ap_proxy_get_worker(cmd->temp_pool, NULL, > conf, de_socketfy(cmd->pool, r)); > +proxy_worker *worker = ap_proxy_get_worker(cmd->temp_pool, NULL, > conf, new->real); Why do we no longer de_socketfy? Looks like this breaks UDS. > int reuse = 0; > if (!worker) { > -const char *err = ap_proxy_define_worker(cmd->pool, &worker, > NULL, conf, r, 0); > +const char *err; > +if (use_regex) { > +err = ap_proxy_define_match_worker(cmd->pool, &worker, NULL, > + conf, r, 0); > +} > +else { > +err = ap_proxy_define_worker(cmd->pool, &worker, NULL, > + conf, r, 0); > +} > if (err) > return apr_pstrcat(cmd->temp_pool, "ProxyPass ", err, NULL); > > PROXY_COPY_CONF_PARAMS(worker, conf); > -} else { > +} > +else if ((use_regex != 0) ^ (worker->s->is_name_matchable)) { Minor nit: I always disliked using bitwise xor for boolean xor :/ We need an mmn bump.
Re: svn commit: r1609680 - in /httpd/httpd/trunk/modules/proxy: mod_proxy.c mod_proxy.h proxy_util.c
On 07/11/2014 12:59 PM, Yann Ylavic wrote: On Fri, Jul 11, 2014 at 12:36 PM, wrote: Author: jkaluza Date: Fri Jul 11 10:36:15 2014 New Revision: 1609680 URL: http://svn.apache.org/r1609680 Log: mod_proxy: add ap_proxy_define_match_worker() and use it for ProxyPassMatch and ProxyMatch section to distinguish between normal workers and workers with regex substitutions in the name. Implement handling of such workers in ap_proxy_get_worker(). PR 43513 [...] --- httpd/httpd/trunk/modules/proxy/mod_proxy.c (original) +++ httpd/httpd/trunk/modules/proxy/mod_proxy.c Fri Jul 11 10:36:15 2014 @@ -1647,15 +1647,30 @@ static const char * new->balancer = balancer; } else { -proxy_worker *worker = ap_proxy_get_worker(cmd->temp_pool, NULL, conf, de_socketfy(cmd->pool, r)); +proxy_worker *worker = ap_proxy_get_worker(cmd->temp_pool, NULL, conf, new->real); int reuse = 0; if (!worker) { -const char *err = ap_proxy_define_worker(cmd->pool, &worker, NULL, conf, r, 0); +const char *err; +if (use_regex) { +err = ap_proxy_define_match_worker(cmd->pool, &worker, NULL, + conf, r, 0); +} +else { +err = ap_proxy_define_worker(cmd->pool, &worker, NULL, + conf, r, 0); +} if (err) return apr_pstrcat(cmd->temp_pool, "ProxyPass ", err, NULL); PROXY_COPY_CONF_PARAMS(worker, conf); -} else { +} +else if ((use_regex != 0) ^ (worker->s->is_name_matchable)) { Maybe (worker->s->is_name_matchable != 0)? Done in r1609688. Thanks. +return apr_pstrcat(cmd->temp_pool, "ProxyPass/ and " + "ProxyPassMatch/ can't be used " + "altogether with the same worker name ", + "(", worker->s->name, ")", NULL); +} +else { reuse = 1; ap_log_error(APLOG_MARK, APLOG_INFO, 0, cmd->server, APLOGNO(01145) "Sharing worker '%s' instead of creating new worker '%s'", [...] @@ -2354,12 +2371,24 @@ static const char *proxysection(cmd_parm worker = ap_proxy_get_worker(cmd->temp_pool, NULL, sconf, de_socketfy(cmd->temp_pool, (char*)conf->p)); if (!worker) { -err = ap_proxy_define_worker(cmd->pool, &worker, NULL, - sconf, conf->p, 0); +if (use_regex) { +err = ap_proxy_define_match_worker(cmd->pool, &worker, NULL, + sconf, conf->p, 0); +} +else { +err = ap_proxy_define_worker(cmd->pool, &worker, NULL, + sconf, conf->p, 0); +} if (err) return apr_pstrcat(cmd->temp_pool, thiscmd->name, " ", err, NULL); } +else if ((use_regex != 0) ^ (worker->s->is_name_matchable)) { Likewise? +return apr_pstrcat(cmd->temp_pool, "ProxyPass/ and " + "ProxyPassMatch/ can't be used " + "altogether with the same worker name ", + "(", worker->s->name, ")", NULL); +}
Re: svn commit: r1609680 - in /httpd/httpd/trunk/modules/proxy: mod_proxy.c mod_proxy.h proxy_util.c
On Fri, Jul 11, 2014 at 12:36 PM, wrote: > Author: jkaluza > Date: Fri Jul 11 10:36:15 2014 > New Revision: 1609680 > > URL: http://svn.apache.org/r1609680 > Log: > mod_proxy: add ap_proxy_define_match_worker() and use it for ProxyPassMatch > and ProxyMatch section to distinguish between normal workers and workers > with regex substitutions in the name. Implement handling of such workers > in ap_proxy_get_worker(). PR 43513 > [...] > --- httpd/httpd/trunk/modules/proxy/mod_proxy.c (original) > +++ httpd/httpd/trunk/modules/proxy/mod_proxy.c Fri Jul 11 10:36:15 2014 > @@ -1647,15 +1647,30 @@ static const char * > new->balancer = balancer; > } > else { > -proxy_worker *worker = ap_proxy_get_worker(cmd->temp_pool, NULL, > conf, de_socketfy(cmd->pool, r)); > +proxy_worker *worker = ap_proxy_get_worker(cmd->temp_pool, NULL, > conf, new->real); > int reuse = 0; > if (!worker) { > -const char *err = ap_proxy_define_worker(cmd->pool, &worker, > NULL, conf, r, 0); > +const char *err; > +if (use_regex) { > +err = ap_proxy_define_match_worker(cmd->pool, &worker, NULL, > + conf, r, 0); > +} > +else { > +err = ap_proxy_define_worker(cmd->pool, &worker, NULL, > + conf, r, 0); > +} > if (err) > return apr_pstrcat(cmd->temp_pool, "ProxyPass ", err, NULL); > > PROXY_COPY_CONF_PARAMS(worker, conf); > -} else { > +} > +else if ((use_regex != 0) ^ (worker->s->is_name_matchable)) { Maybe (worker->s->is_name_matchable != 0)? > +return apr_pstrcat(cmd->temp_pool, "ProxyPass/ and " > + "ProxyPassMatch/ can't be used " > + "altogether with the same worker name ", > + "(", worker->s->name, ")", NULL); > +} > +else { > reuse = 1; > ap_log_error(APLOG_MARK, APLOG_INFO, 0, cmd->server, > APLOGNO(01145) > "Sharing worker '%s' instead of creating new worker > '%s'", [...] > @@ -2354,12 +2371,24 @@ static const char *proxysection(cmd_parm > worker = ap_proxy_get_worker(cmd->temp_pool, NULL, sconf, > de_socketfy(cmd->temp_pool, > (char*)conf->p)); > if (!worker) { > -err = ap_proxy_define_worker(cmd->pool, &worker, NULL, > - sconf, conf->p, 0); > +if (use_regex) { > +err = ap_proxy_define_match_worker(cmd->pool, &worker, > NULL, > + sconf, conf->p, 0); > +} > +else { > +err = ap_proxy_define_worker(cmd->pool, &worker, NULL, > + sconf, conf->p, 0); > +} > if (err) > return apr_pstrcat(cmd->temp_pool, thiscmd->name, > " ", err, NULL); > } > +else if ((use_regex != 0) ^ (worker->s->is_name_matchable)) { Likewise? > +return apr_pstrcat(cmd->temp_pool, "ProxyPass/ and " > + "ProxyPassMatch/ can't be > used " > + "altogether with the same worker name ", > + "(", worker->s->name, ")", NULL); > +}