Skip to content

Commit 0f06843

Browse files
committed
test: Consider the 'connection' header value as case-insensitive
This differs between Nginx versions and also may be normalized by Highwinds. Both 'keep-alive' and 'Keep-Alive' are fine.
1 parent 561681e commit 0f06843

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

test/Unit.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ function jq_req( $url, array $reqHeaders = [] ) {
99
CURLOPT_RETURNTRANSFER => 1,
1010
CURLOPT_FOLLOWLOCATION => 0,
1111
CURLOPT_HEADERFUNCTION => function( $ch, $header ) use ( &$resp ) {
12+
$caseInsensitiveHeaders = [
13+
'connection'
14+
];
1215
$len = strlen( $header );
1316
if ( preg_match( "/^(HTTP\/(?:1\.[01]|2)) (\d{3} .*)/", $header, $m ) ) {
1417
$resp['headers'] = [];
@@ -18,6 +21,9 @@ function jq_req( $url, array $reqHeaders = [] ) {
1821
if ( count( $parts ) === 2 ) {
1922
$name = strtolower( $parts[0] );
2023
$val = trim( $parts[1] );
24+
if ( in_array( $name, $caseInsensitiveHeaders ) ) {
25+
$val = strtolower( $val );
26+
}
2127
if ( isset( $resp['headers'][$name] ) ) {
2228
$resp['headers'][$name] .= ", $val";
2329
} else {

test/static-open.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131
'connection' => 'keep-alive',
3232
'vary' => 'Accept-Encoding, x-cdn-access',
3333
'etag' => '"28feccc0-40464"',
34-
'expires' => 'Thu, 31 Dec 2037 23:55:55 GMT',
3534
'cache-control' => 'max-age=315360000, public',
3635
'access-control-allow-origin' => '*',
3736
'accept-ranges' => 'bytes',
@@ -46,7 +45,6 @@
4645
'connection' => 'keep-alive',
4746
'vary' => 'Accept-Encoding, x-cdn-access',
4847
'etag' => '"28feccc0-1d20"',
49-
'expires' => 'Thu, 31 Dec 2037 23:55:55 GMT',
5048
'cache-control' => 'max-age=315360000, public',
5149
'access-control-allow-origin' => '*',
5250
'accept-ranges' => 'bytes',
@@ -60,7 +58,6 @@
6058
'last-modified' => 'Fri, 18 Oct 1991 12:00:00 GMT',
6159
'connection' => 'keep-alive',
6260
'etag' => '"28feccc0-1111"',
63-
'expires' => 'Thu, 31 Dec 2037 23:55:55 GMT',
6461
'cache-control' => 'max-age=315360000, public',
6562
'access-control-allow-origin' => '*',
6663
'accept-ranges' => 'bytes',
@@ -74,7 +71,6 @@
7471
'last-modified' => 'Fri, 18 Oct 1991 12:00:00 GMT',
7572
'connection' => 'keep-alive',
7673
'etag' => '"28feccc0-1ec81"',
77-
'expires' => 'Thu, 31 Dec 2037 23:55:55 GMT',
7874
'cache-control' => 'max-age=315360000, public',
7975
'access-control-allow-origin' => '*',
8076
'accept-ranges' => 'bytes',
@@ -93,7 +89,6 @@
9389
'connection' => 'keep-alive',
9490
'vary' => 'Accept-Encoding, x-cdn-access',
9591
'etag' => '"28feccc0-40464"',
96-
'expires' => 'Thu, 31 Dec 2037 23:55:55 GMT',
9792
'cache-control' => 'max-age=315360000, public',
9893
'access-control-allow-origin' => '*',
9994
'accept-ranges' => 'bytes',

test/static-strict.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@
4040
'connection' => 'keep-alive',
4141
'vary' => 'Accept-Encoding, x-cdn-access',
4242
'etag' => '"28feccc0-40464"',
43-
'expires' => 'Thu, 31 Dec 2037 23:55:55 GMT',
4443
'cache-control' => 'max-age=315360000, public',
4544
'access-control-allow-origin' => '*',
4645
'accept-ranges' => 'bytes',

0 commit comments

Comments
 (0)