refactored the tests for varnish 4

The X-Varnish header changed a bit in Varnish 4 so the tests can't use
the header consistently with both Varnish 3 and 4.