Skip to content

Commit eb6f0ae

Browse files
committed
Refactored the test code from the vcl
1 parent 78475d2 commit eb6f0ae

File tree

7 files changed

+31
-6
lines changed

7 files changed

+31
-6
lines changed

doc/varnish-configuration.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,7 @@ To enable support add the following to ``your_varnish.vcl``:
211211
.. code-block:: varnish4
212212
213213
include "path-to-config/varnish-4/fos_user_context.vcl";
214+
include "path-to-config/varnish-4/fos_user_context_url.vcl";
214215
215216
sub vcl_recv {
216217
call fos_user_context_recv;
@@ -227,6 +228,7 @@ To enable support add the following to ``your_varnish.vcl``:
227228
.. code-block:: varnish3
228229
229230
include "path-to-config/varnish-3/fos_user_context.vcl";
231+
include "path-to-config/varnish-4/fos_user_context_url.vcl";
230232
231233
sub vcl_recv {
232234
call fos_user_context_recv;

resources/config/varnish-3/fos_user_context.vcl

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,7 @@ sub fos_user_context_recv {
3333

3434
# Backup original URL
3535
set req.http.X-Fos-Original-Url = req.url;
36-
set req.url = "/_fos_user_context_hash";
37-
38-
# For functional tests
36+
3937
call user_context_hash_url;
4038

4139
# Force the lookup, the backend must tell not to cache or vary on all
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
/*
2+
* This file is part of the FOSHttpCache package.
3+
*
4+
* (c) FriendsOfSymfony <http://friendsofsymfony.github.com/>
5+
*
6+
* For the full copyright and license information, please view the LICENSE
7+
* file that was distributed with this source code.
8+
*/
9+
10+
sub user_context_hash_url {
11+
set req.url = "/_fos_user_context_hash";
12+
}

resources/config/varnish-4/fos_user_context.vcl

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,7 @@ sub fos_user_context_recv {
3333

3434
# Backup original URL
3535
set req.http.X-Fos-Original-Url = req.url;
36-
set req.url = "/_fos_user_context_hash";
37-
38-
# For functional tests
36+
3937
call user_context_hash_url;
4038

4139
# Force the lookup, the backend must tell not to cache or vary on all
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
/*
2+
* This file is part of the FOSHttpCache package.
3+
*
4+
* (c) FriendsOfSymfony <http://friendsofsymfony.github.com/>
5+
*
6+
* For the full copyright and license information, please view the LICENSE
7+
* file that was distributed with this source code.
8+
*/
9+
10+
sub user_context_hash_url {
11+
set req.url = "/_fos_user_context_hash";
12+
}

tests/Functional/Fixtures/varnish-3/fos.vcl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ include "../../../../resources/config/varnish-3/fos_refresh.vcl";
33
include "../../../../resources/config/varnish-3/fos_purge.vcl";
44
include "../../../../resources/config/varnish-3/fos_ban.vcl";
55
include "../../../../resources/config/varnish-3/fos_custom_ttl.vcl";
6+
include "../../../../resources/config/varnish-3/fos_user_context_url.vcl";
7+
68

79
backend default {
810
.host = "127.0.0.1";

tests/Functional/Fixtures/varnish-4/fos.vcl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ include "../../../../resources/config/varnish-4/fos_debug.vcl";
44
include "../../../../resources/config/varnish-4/fos_refresh.vcl";
55
include "../../../../resources/config/varnish-4/fos_purge.vcl";
66
include "../../../../resources/config/varnish-4/fos_ban.vcl";
7+
include "../../../../resources/config/varnish-4/fos_user_context_url.vcl";
78

89
backend default {
910
.host = "127.0.0.1";

0 commit comments

Comments
 (0)