Skip to content

Commit 238377e

Browse files
committed
Make sure fixtures send correct Content-Length header
1 parent 46e3742 commit 238377e

File tree

9 files changed

+41
-2
lines changed

9 files changed

+41
-2
lines changed

tests/Functional/Fixtures/web/cache.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,11 @@
99
* file that was distributed with this source code.
1010
*/
1111

12+
$mt = microtime(true);
13+
1214
header('Cache-Control: max-age=3600');
1315
header('Content-Type: text/html');
1416
header('X-Cache-Debug: 1');
17+
header('Content-Length: ' . strlen($mt));
1518

16-
echo microtime(true);
19+
echo $mt;

tests/Functional/Fixtures/web/custom-ttl.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,12 @@
99
* file that was distributed with this source code.
1010
*/
1111

12+
$mt = microtime(true);
13+
1214
header('Cache-Control: s-maxage=0');
1315
header('X-Reverse-Proxy-TTL: 3600');
1416
header('Content-Type: text/html');
1517
header('X-Cache-Debug: 1');
18+
header('Content-Length: ' . strlen($mt));
1619

17-
echo microtime(true);
20+
echo $mt;

tests/Functional/Fixtures/web/json.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@
99
* file that was distributed with this source code.
1010
*/
1111

12+
$mt = microtime(true);
13+
1214
header('Cache-Control: max-age=3600');
1315
header('Content-Type: text/json');
1416
header('X-Cache-Debug: 1');
17+
header('Content-Length: ' . strlen($mt));
18+
19+
echo $mt;

tests/Functional/Fixtures/web/negotiation.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,12 @@
99
* file that was distributed with this source code.
1010
*/
1111

12+
$mt = microtime(true);
13+
1214
header('Cache-Control: max-age=3600');
1315
header(sprintf('Content-Type: %s', $_SERVER['HTTP_ACCEPT']));
1416
header('X-Cache-Debug: 1');
1517
header('Vary: Accept');
18+
header('Content-Length: ' . strlen($mt));
19+
20+
echo $mt;

tests/Functional/Fixtures/web/tags.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,13 @@
99
* file that was distributed with this source code.
1010
*/
1111

12+
$mt = microtime(true);
13+
1214
header('Cache-Control: max-age=3600');
1315
header('Content-Type: text/html');
1416
header('X-Cache-Tags: tag1,tag2');
1517
header('X-LiteSpeed-Tag: tag1, tag2'); // For LiteSpeed
1618
header('X-Cache-Debug: 1');
19+
header('Content-Length: ' . strlen($mt));
20+
21+
echo $mt;

tests/Functional/Fixtures/web/tags_multi_header.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,13 @@
99
* file that was distributed with this source code.
1010
*/
1111

12+
$mt = microtime(true);
13+
1214
header('Cache-Control: max-age=3600');
1315
header('Content-Type: text/html');
1416
header('X-Cache-Tags: tag1');
1517
header('X-Cache-Tags: tag2');
1618
header('X-Cache-Debug: 1');
19+
header('Content-Length: ' . strlen($mt));
20+
21+
echo $mt;

tests/Functional/Fixtures/web/tags_xkey.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,12 @@
99
* file that was distributed with this source code.
1010
*/
1111

12+
$mt = microtime(true);
13+
1214
header('Cache-Control: max-age=3600');
1315
header('Content-Type: text/html');
1416
header('xkey: tag1 tag2');
1517
header('X-Cache-Debug: 1');
18+
header('Content-Length: ' . strlen($mt));
19+
20+
echo $mt;

tests/Functional/Fixtures/web/user_context.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
}
2323

2424
if ('POST' === strtoupper($_SERVER['REQUEST_METHOD'])) {
25+
header('Content-Length: 4');
2526
echo 'POST';
2627
exit;
2728
}
@@ -33,6 +34,7 @@
3334

3435
header('Cache-Control: max-age=3600');
3536
header('Vary: X-User-Context-Hash');
37+
header('Content-Length: 3');
3638

3739
if ('foo' === $_COOKIE[0]) {
3840
header('X-HashTest: foo');

tests/Functional/Fixtures/web/user_context_anon.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,17 @@
1616

1717
if (!isset($_COOKIE[0])) {
1818
header('X-HashTest: anonymous');
19+
header('Content-Length: 9');
20+
1921
echo 'anonymous';
2022
} elseif ('foo' === $_COOKIE[0]) {
2123
header('X-HashTest: foo');
24+
header('Content-Length: 3');
25+
2226
echo 'foo';
2327
} else {
2428
header('X-HashTest: bar');
29+
header('Content-Length: 3');
30+
2531
echo 'bar';
2632
}

0 commit comments

Comments
 (0)