From 23dd12711fcba5f3898cd93d8c5e1aa8daaa7509 Mon Sep 17 00:00:00 2001 From: Antonio Terceiro Date: Thu, 30 Aug 2012 12:19:10 -0300 Subject: [PATCH] [varnish] do not return() from our custom VCL --- etc/noosfero/varnish-noosfero.vcl | 8 +++----- test/integration/varnish_conf_test.rb | 9 +++++++++ 2 files changed, 12 insertions(+), 5 deletions(-) create mode 100644 test/integration/varnish_conf_test.rb diff --git a/etc/noosfero/varnish-noosfero.vcl b/etc/noosfero/varnish-noosfero.vcl index 4aff0aa..ede7de7 100644 --- a/etc/noosfero/varnish-noosfero.vcl +++ b/etc/noosfero/varnish-noosfero.vcl @@ -3,13 +3,11 @@ sub vcl_recv { if (req.http.Cookie) { # We only care about the "_noosfero_session.*" cookie, used for # authentication. - if (req.http.Cookie ~ "_noosfero_session.*" ) { - return (pass); + if (req.http.Cookie !~ "_noosfero_session.*" ) { + # strip all cookies + unset req.http.Cookie; } - # Else strip all cookies - unset req.http.Cookie; } - } } sub vcl_error { diff --git a/test/integration/varnish_conf_test.rb b/test/integration/varnish_conf_test.rb new file mode 100644 index 0000000..4bbc85a --- /dev/null +++ b/test/integration/varnish_conf_test.rb @@ -0,0 +1,9 @@ +require 'test/unit' + +class VarnishConfTest < Test::Unit::TestCase + + def test_not_use_return_in_varnish_noosfero + assert !system('grep "return.*pass" etc/noosfero/varnish-noosfero.vcl') + end + +end -- libgit2 0.21.2