]> git.kaiwu.me - nginx.git/commitdiff
Style: unified request method checks.
authorRuslan Ermilov <ru@nginx.com>
Fri, 6 Nov 2015 12:22:43 +0000 (15:22 +0300)
committerRuslan Ermilov <ru@nginx.com>
Fri, 6 Nov 2015 12:22:43 +0000 (15:22 +0300)
src/http/modules/ngx_http_chunked_filter_module.c
src/http/modules/ngx_http_static_module.c
src/http/modules/ngx_http_stub_status_module.c
src/http/ngx_http_request.c
src/http/ngx_http_upstream.c

index a7dc5bf4d4beaf5f7ddac945033edf41226ffb61..0059a98d6ef6a1a8bf58a6635626b0fa466734ca 100644 (file)
@@ -64,7 +64,7 @@ ngx_http_chunked_header_filter(ngx_http_request_t *r)
         || r->headers_out.status == NGX_HTTP_NO_CONTENT
         || r->headers_out.status < NGX_HTTP_OK
         || r != r->main
-        || (r->method & NGX_HTTP_HEAD))
+        || r->method == NGX_HTTP_HEAD)
     {
         return ngx_http_next_header_filter(r);
     }
index 631eb17b26757402c09759e43741015fcd4cf995..f79c4aeeed0f7c52d4a294930842423c4657edca 100644 (file)
@@ -204,7 +204,7 @@ ngx_http_static_handler(ngx_http_request_t *r)
 
 #endif
 
-    if (r->method & NGX_HTTP_POST) {
+    if (r->method == NGX_HTTP_POST) {
         return NGX_HTTP_NOT_ALLOWED;
     }
 
index dd6835898036d17336362fbdd246173d13c37e02..61199f2fbb1f0e2d58124676869c33173a71d94f 100644 (file)
@@ -89,7 +89,7 @@ ngx_http_stub_status_handler(ngx_http_request_t *r)
     ngx_chain_t        out;
     ngx_atomic_int_t   ap, hn, ac, rq, rd, wr, wa;
 
-    if (r->method != NGX_HTTP_GET && r->method != NGX_HTTP_HEAD) {
+    if (!(r->method & (NGX_HTTP_GET|NGX_HTTP_HEAD))) {
         return NGX_HTTP_NOT_ALLOWED;
     }
 
index ab7c15f64218b0ecd7ff0bcaf91946f8eb0af9cd..b68a13d3acce2fda672683aac0a73e728cc7a860 100644 (file)
@@ -1788,7 +1788,7 @@ ngx_http_process_request_header(ngx_http_request_t *r)
         }
     }
 
-    if (r->method & NGX_HTTP_TRACE) {
+    if (r->method == NGX_HTTP_TRACE) {
         ngx_log_error(NGX_LOG_INFO, r->connection->log, 0,
                       "client sent TRACE method");
         ngx_http_finalize_request(r, NGX_HTTP_NOT_ALLOWED);
index 8a9fbac465de73eb57f15ffad07310353f137bd4..c618ce6c499576ee79e5fd1db4ac36052fe68199 100644 (file)
@@ -772,7 +772,7 @@ ngx_http_upstream_cache(ngx_http_request_t *r, ngx_http_upstream_t *u)
             return rc;
         }
 
-        if ((r->method & NGX_HTTP_HEAD) && u->conf->cache_convert_head) {
+        if (r->method == NGX_HTTP_HEAD && u->conf->cache_convert_head) {
             u->method = ngx_http_core_get_method;
         }