]> git.kaiwu.me - nginx.git/commitdiff
cache GET requests only
authorIgor Sysoev <igor@sysoev.ru>
Fri, 3 Apr 2009 12:06:04 +0000 (12:06 +0000)
committerIgor Sysoev <igor@sysoev.ru>
Fri, 3 Apr 2009 12:06:04 +0000 (12:06 +0000)
src/http/ngx_http_upstream.c

index 1ff6ae4f6ab2b4e67051fb758309ac154cfa381d..76f1bc3f8c7f54f9e4b0e86316140c235ec05081 100644 (file)
@@ -531,6 +531,10 @@ ngx_http_upstream_cache(ngx_http_request_t *r, ngx_http_upstream_t *u)
     ngx_int_t          rc;
     ngx_http_cache_t  *c;
 
+    if (!(r->method & NGX_HTTP_GET)) {
+        return NGX_DECLINED;
+    }
+
     c = ngx_pcalloc(r->pool, sizeof(ngx_http_cache_t));
     if (c == NULL) {
         return NGX_ERROR;