Welcome! Log In Create A New Profile

Advanced

Re: DAV + выделение regex + alias

Maxim Dounin
May 15, 2014 02:02PM
Hello!

On Tue, Apr 29, 2014 at 10:18:31AM +0400, Vadim Lazovskiy wrote:

> Нет, поторопился.
>
> Сломались другие location с проксированием вот такого вида:

[...]

Более правильный патч какой-то такой:

--- a/src/http/ngx_http_core_module.c
+++ b/src/http/ngx_http_core_module.c
@@ -2009,7 +2009,7 @@ ngx_http_map_uri_to_path(ngx_http_reques
#if (NGX_PCRE)
ngx_uint_t captures;

- captures = alias && clcf->regex;
+ captures = (alias == NGX_MAX_SIZE_T_VALUE) ? 1 : 0;

reserved += captures ? r->add_uri_to_alias ? r->uri.len + 1 : 1
: r->uri.len - alias + 1;
@@ -4476,6 +4476,7 @@ ngx_http_core_root(ngx_conf_t *cf, ngx_c

#if (NGX_PCRE)
if (alias && clcf->regex) {
+ clcf->alias = NGX_MAX_SIZE_T_VALUE;
n = 1;
}
#endif


>
>
> 2014-04-28 22:31 GMT+04:00 Maxim Dounin <mdounin@mdounin.ru>:
>
> > Hello!
> >
> > On Mon, Apr 28, 2014 at 01:22:08PM +0400, Vadim Lazovskiy wrote:
> >
> > > Вопрос. Откуда берется домен в имени файла и как это побороть?
> >
> > Выглядит как баг regex location + alias + limit_except/if.
> > Собственно, для случая if он уже давно задокументирован на
> > http://wiki.nginx.org/IfIsEvil.
> >
> > Патч, видимо, какой-то такой:
> >
> > # HG changeset patch
> > # User Maxim Dounin <mdounin@mdounin.ru>
> > # Date 1398709755 -14400
> > # Mon Apr 28 22:29:15 2014 +0400
> > # Node ID cf4f92f40290c9d3b8a8fb8cf836d3ebd16224f5
> > # Parent 539635cb8e98063b116555bdfd0c5ccfbfa8f184
> > Fixed alias in regex locations with limit_except/if.
> >
> > The ngx_http_map_uri_to_path() function uses clcf->regex to detect if
> > it's working within a location given by a regular expression. Its
> > behaviour was incorrect due to clcf->regex being false in implicit
> > locations
> > created by if and limit_except. Fix is to preserve clcf->regex within
> > implicit locations.
> >
> > diff --git a/src/http/modules/ngx_http_rewrite_module.c
> > b/src/http/modules/ngx_http_rewrite_module.c
> > --- a/src/http/modules/ngx_http_rewrite_module.c
> > +++ b/src/http/modules/ngx_http_rewrite_module.c
> > @@ -583,6 +583,7 @@ ngx_http_rewrite_if(ngx_conf_t *cf, ngx_
> > clcf = ctx->loc_conf[ngx_http_core_module.ctx_index];
> > clcf->loc_conf = ctx->loc_conf;
> > clcf->name = pclcf->name;
> > + clcf->regex = pclcf->regex;
> > clcf->noname = 1;
> >
> > if (ngx_http_add_location(cf, &pclcf->locations, clcf) != NGX_OK) {
> > diff --git a/src/http/ngx_http_core_module.c
> > b/src/http/ngx_http_core_module.c
> > --- a/src/http/ngx_http_core_module.c
> > +++ b/src/http/ngx_http_core_module.c
> > @@ -4597,6 +4597,7 @@ ngx_http_core_limit_except(ngx_conf_t *c
> > pclcf->limit_except_loc_conf = ctx->loc_conf;
> > clcf->loc_conf = ctx->loc_conf;
> > clcf->name = pclcf->name;
> > + clcf->regex = pclcf->regex;
> > clcf->noname = 1;
> > clcf->lmt_excpt = 1;
> >
> >
> >
> > --
> > Maxim Dounin
> > http://nginx.org/
> >
> > _______________________________________________
> > nginx-ru mailing list
> > nginx-ru@nginx.org
> > http://mailman.nginx.org/mailman/listinfo/nginx-ru
>
>
>
>
> --
> Best Regards,
> Vadim Lazovskiy

> _______________________________________________
> nginx-ru mailing list
> nginx-ru@nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx-ru


--
Maxim Dounin
http://nginx.org/

_______________________________________________
nginx-ru mailing list
nginx-ru@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-ru
Subject Author Posted

DAV + выделение regex + alias

Vadim Lazovskiy April 28, 2014 05:24AM

Re: DAV + выделение regex + alias

Maxim Dounin April 28, 2014 02:32PM

Re: DAV + выделение regex + alias

Vadim Lazovskiy April 29, 2014 01:52AM

Re: DAV + выделение regex + alias

Vadim Lazovskiy April 29, 2014 02:20AM

Re: DAV + выделение regex + alias

Maxim Dounin May 15, 2014 02:02PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 164
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready