[master] 2b1ac1c Ref: https://tools.ietf.org/html/rfc7231#section-6.1

Nils Goroll nils.goroll at uplex.de
Mon May 18 10:46:51 CEST 2015


commit 2b1ac1ca1950026fe824c0194d0591579e4dda5b
Author: Nils Goroll <nils.goroll at uplex.de>
Date:   Mon May 18 10:45:59 2015 +0200

    Ref: https://tools.ietf.org/html/rfc7231#section-6.1
    
    Changes:
    
    * 302 Found
    * 307 Temporary Redirect
    
      Do not apply the default ttl, only set a ttl if Cache-Control or Expires are
    present.
      Responses with these status codes are not cacheable by default
    
    * 414 Request-URI Too Large
    
      Cacheable with "heuristic expiration"
    
    https://www.varnish-cache.org/patchwork/patch/251/

diff --git a/bin/varnishd/cache/cache_rfc2616.c b/bin/varnishd/cache/cache_rfc2616.c
index d1ce206..d3ea762 100644
--- a/bin/varnishd/cache/cache_rfc2616.c
+++ b/bin/varnishd/cache/cache_rfc2616.c
@@ -111,15 +111,18 @@ RFC2616_Ttl(struct busyobj *bo, double now)
 	default:
 		expp->ttl = -1.;
 		break;
+	case 302: /* Moved Temporarily */
+	case 307: /* Temporary Redirect */
+		expp->ttl = -1.;
 	case 200: /* OK */
 	case 203: /* Non-Authoritative Information */
+	case 204: /* No Content */
 	case 300: /* Multiple Choices */
 	case 301: /* Moved Permanently */
-	case 302: /* Moved Temporarily */
-	case 304: /* Not Modified */
-	case 307: /* Temporary Redirect */
-	case 410: /* Gone */
+	case 304: /* Not Modified - handled like 200 */
 	case 404: /* Not Found */
+	case 410: /* Gone */
+	case 414: /* Request-URI Too Large */
 		/*
 		 * First find any relative specification from the backend
 		 * These take precedence according to RFC2616, 13.2.4
diff --git a/bin/varnishtest/tests/b00015.vtc b/bin/varnishtest/tests/b00015.vtc
index 029f782..e26b16d 100644
--- a/bin/varnishtest/tests/b00015.vtc
+++ b/bin/varnishtest/tests/b00015.vtc
@@ -32,7 +32,7 @@ varnish v1 -cliok "ban req.url ~ .*"
 
 server s1 {
 	rxreq
-	txresp -status 302
+	txresp -status 301
 } -start
 
 varnish v1 -vcl+backend {
@@ -45,7 +45,7 @@ varnish v1 -vcl+backend {
 client c1 {
 	txreq -url "/"
 	rxresp
-	expect resp.status == 302
+	expect resp.status == 301
 	expect resp.http.X-varnish == "1007"
 } -run
 
@@ -54,7 +54,7 @@ delay .1
 client c1 {
 	txreq -url "/"
 	rxresp
-	expect resp.status == 302
+	expect resp.status == 301
 	expect resp.http.X-varnish == "1010 1008"
 } -run
 



More information about the varnish-commit mailing list