<div dir="ltr"><div>I meant, from the diff, it looked like all single HTTP method checks were transitioned from & to ==, while that single one was changed from == to &. I understand now, the checks were unified with the ones that were not in the diff (duh, I should have though about that).</div><div><br></div><div>Still, as a result in some places "&" is used, and in another == is. So IMHO I don't see the point in using == for single method checks and & for multiple in terms of unifying usage throughout the code.</div><div><br></div><div>But, thanks a lot for clarifying. It makes sense.</div></div><div class="gmail_extra"><br><div class="gmail_quote">2015-11-25 13:07 GMT+02:00 Ruslan Ermilov <span dir="ltr"><<a href="mailto:ru@nginx.com" target="_blank">ru@nginx.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5">On Tue, Nov 24, 2015 at 11:31:16PM +0200, Sorin Manole wrote:<br>
> 2015-11-24 22:41 GMT+02:00 Ruslan Ermilov <<a href="mailto:ru@nginx.com">ru@nginx.com</a>>:<br>
><br>
> > details:   <a href="http://hg.nginx.org/nginx/rev/b1858fc47e3b" rel="noreferrer" target="_blank">http://hg.nginx.org/nginx/rev/b1858fc47e3b</a><br>
> > branches:<br>
> > changeset: 6306:b1858fc47e3b<br>
> > user:      Ruslan Ermilov <<a href="mailto:ru@nginx.com">ru@nginx.com</a>><br>
> > date:      Fri Nov 06 15:22:43 2015 +0300<br>
> > description:<br>
> > Style: unified request method checks.<br>
> ><br>
> > diffstat:<br>
> ><br>
> >  src/http/modules/ngx_http_chunked_filter_module.c |  2 +-<br>
> >  src/http/modules/ngx_http_static_module.c         |  2 +-<br>
> >  src/http/modules/ngx_http_stub_status_module.c    |  2 +-<br>
> >  src/http/ngx_http_request.c                       |  2 +-<br>
> >  src/http/ngx_http_upstream.c                      |  2 +-<br>
> >  5 files changed, 5 insertions(+), 5 deletions(-)<br>
> ><br>
> > diffs (60 lines):<br>
> ><br>
> > diff -r 18428f775b2c -r b1858fc47e3b<br>
> > src/http/modules/ngx_http_chunked_filter_module.c<br>
> > --- a/src/http/modules/ngx_http_chunked_filter_module.c Mon Nov 23<br>
> > 12:40:19 2015 +0300<br>
> > +++ b/src/http/modules/ngx_http_chunked_filter_module.c Fri Nov 06<br>
> > 15:22:43 2015 +0300<br>
> > @@ -64,7 +64,7 @@ ngx_http_chunked_header_filter(ngx_http_<br>
> >          || r->headers_out.status == NGX_HTTP_NO_CONTENT<br>
> >          || r->headers_out.status < NGX_HTTP_OK<br>
> >          || r != r->main<br>
> > -        || (r->method & NGX_HTTP_HEAD))<br>
> > +        || r->method == NGX_HTTP_HEAD)<br>
> >      {<br>
> >          return ngx_http_next_header_filter(r);<br>
> >      }<br>
> > diff -r 18428f775b2c -r b1858fc47e3b<br>
> > src/http/modules/ngx_http_static_module.c<br>
> > --- a/src/http/modules/ngx_http_static_module.c Mon Nov 23 12:40:19 2015<br>
> > +0300<br>
> > +++ b/src/http/modules/ngx_http_static_module.c Fri Nov 06 15:22:43 2015<br>
> > +0300<br>
> > @@ -204,7 +204,7 @@ ngx_http_static_handler(ngx_http_request<br>
> ><br>
> >  #endif<br>
> ><br>
> > -    if (r->method & NGX_HTTP_POST) {<br>
> > +    if (r->method == NGX_HTTP_POST) {<br>
> >          return NGX_HTTP_NOT_ALLOWED;<br>
> >      }<br>
> ><br>
> > diff -r 18428f775b2c -r b1858fc47e3b<br>
> > src/http/modules/ngx_http_stub_status_module.c<br>
> > --- a/src/http/modules/ngx_http_stub_status_module.c    Mon Nov 23<br>
> > 12:40:19 2015 +0300<br>
> > +++ b/src/http/modules/ngx_http_stub_status_module.c    Fri Nov 06<br>
> > 15:22:43 2015 +0300<br>
> > @@ -89,7 +89,7 @@ ngx_http_stub_status_handler(ngx_http_re<br>
> >      ngx_chain_t        out;<br>
> >      ngx_atomic_int_t   ap, hn, ac, rq, rd, wr, wa;<br>
> ><br>
> > -    if (r->method != NGX_HTTP_GET && r->method != NGX_HTTP_HEAD) {<br>
> > +    if (!(r->method & (NGX_HTTP_GET|NGX_HTTP_HEAD))) {<br>
> ><br>
> Since it's about the style, not really an unification I would say.<br>
<br>
</div></div>What did you mean to say, I don't quite follow?<br>
This particular part of the change is about unification:<br>
<br>
ngx_http_autoindex_module.c:    if (!(r->method & (NGX_HTTP_GET|NGX_HTTP_HEAD))) {<br>
ngx_http_empty_gif_module.c:    if (!(r->method & (NGX_HTTP_GET|NGX_HTTP_HEAD))) {<br>
ngx_http_flv_module.c:    if (!(r->method & (NGX_HTTP_GET|NGX_HTTP_HEAD))) {<br>
ngx_http_gzip_static_module.c:    if (!(r->method & (NGX_HTTP_GET|NGX_HTTP_HEAD))) {<br>
ngx_http_index_module.c:    if (!(r->method & (NGX_HTTP_GET|NGX_HTTP_HEAD|NGX_HTTP_POST))) {<br>
ngx_http_memcached_module.c:    if (!(r->method & (NGX_HTTP_GET|NGX_HTTP_HEAD))) {<br>
ngx_http_mp4_module.c:    if (!(r->method & (NGX_HTTP_GET|NGX_HTTP_HEAD))) {<br>
ngx_http_random_index_module.c:    if (!(r->method & (NGX_HTTP_GET|NGX_HTTP_HEAD|NGX_HTTP_POST))) {<br>
ngx_http_static_module.c:    if (!(r->method & (NGX_HTTP_GET|NGX_HTTP_HEAD|NGX_HTTP_POST))) {<br>
ngx_http_stub_status_module.c:    if (!(r->method & (NGX_HTTP_GET|NGX_HTTP_HEAD))) {<br>
<span class="im HOEnZb"><br>
> >          return NGX_HTTP_NOT_ALLOWED;<br>
> >      }<br>
> ><br>
> > diff -r 18428f775b2c -r b1858fc47e3b src/http/ngx_http_request.c<br>
> > --- a/src/http/ngx_http_request.c       Mon Nov 23 12:40:19 2015 +0300<br>
> > +++ b/src/http/ngx_http_request.c       Fri Nov 06 15:22:43 2015 +0300<br>
> > @@ -1788,7 +1788,7 @@ ngx_http_process_request_header(ngx_http<br>
> >          }<br>
> >      }<br>
> ><br>
> > -    if (r->method & NGX_HTTP_TRACE) {<br>
> > +    if (r->method == NGX_HTTP_TRACE) {<br>
> >          ngx_log_error(NGX_LOG_INFO, r->connection->log, 0,<br>
> >                        "client sent TRACE method");<br>
> >          ngx_http_finalize_request(r, NGX_HTTP_NOT_ALLOWED);<br>
> > diff -r 18428f775b2c -r b1858fc47e3b src/http/ngx_http_upstream.c<br>
> > --- a/src/http/ngx_http_upstream.c      Mon Nov 23 12:40:19 2015 +0300<br>
> > +++ b/src/http/ngx_http_upstream.c      Fri Nov 06 15:22:43 2015 +0300<br>
> > @@ -772,7 +772,7 @@ ngx_http_upstream_cache(ngx_http_request<br>
> >              return rc;<br>
> >          }<br>
> ><br>
> > -        if ((r->method & NGX_HTTP_HEAD) && u->conf->cache_convert_head) {<br>
> > +        if (r->method == NGX_HTTP_HEAD && u->conf->cache_convert_head) {<br>
> >              u->method = ngx_http_core_get_method;<br>
> >          }<br>
> ><br>
> ><br>
> > _______________________________________________<br>
> > nginx-devel mailing list<br>
> > <a href="mailto:nginx-devel@nginx.org">nginx-devel@nginx.org</a><br>
> > <a href="http://mailman.nginx.org/mailman/listinfo/nginx-devel" rel="noreferrer" target="_blank">http://mailman.nginx.org/mailman/listinfo/nginx-devel</a><br>
> ><br>
<br>
<br>
</span><span class="HOEnZb"><font color="#888888">--<br>
Ruslan Ermilov<br>
</font></span><div class="HOEnZb"><div class="h5"><br>
_______________________________________________<br>
nginx-devel mailing list<br>
<a href="mailto:nginx-devel@nginx.org">nginx-devel@nginx.org</a><br>
<a href="http://mailman.nginx.org/mailman/listinfo/nginx-devel" rel="noreferrer" target="_blank">http://mailman.nginx.org/mailman/listinfo/nginx-devel</a><br>
</div></div></blockquote></div><br></div>