@@ -1313,4 +1313,50 @@ public function testHTTPversionAsString(): void
1313
1313
$ this ->assertArrayHasKey (CURLOPT_HTTP_VERSION , $ options );
1314
1314
$ this ->assertSame (CURL_HTTP_VERSION_2_0 , $ options [CURLOPT_HTTP_VERSION ]);
1315
1315
}
1316
+
1317
+ public function testRemoveMultipleRedirectHeaderSections (): void
1318
+ {
1319
+ $ testBody = 'Hello world ' ;
1320
+
1321
+ $ output = "HTTP/1.1 301 Moved Permanently
1322
+ content-type: text/html; charset=utf-8
1323
+ content-length: 211
1324
+ location: http://example.com
1325
+ date: Mon, 20 Jan 2025 11:46:34 GMT
1326
+ server: nginx/1.21.6
1327
+ vary: Origin \r\n\r\nHTTP/1.1 302 Found
1328
+ content-type: text/html; charset=utf-8
1329
+ content-length: 211
1330
+ location: http://example.com
1331
+ date: Mon, 20 Jan 2025 11:46:34 GMT
1332
+ server: nginx/1.21.6
1333
+ vary: Origin \r\n\r\nHTTP/1.1 307 Temporary Redirect
1334
+ content-type: text/html; charset=utf-8
1335
+ content-length: 211
1336
+ location: http://example.com
1337
+ date: Mon, 20 Jan 2025 11:46:34 GMT
1338
+ server: nginx/1.21.6
1339
+ vary: Origin \r\n\r\nHTTP/2 308
1340
+ content-type: text/html; charset=utf-8
1341
+ content-length: 211
1342
+ location: http://example.com
1343
+ date: Mon, 20 Jan 2025 11:46:34 GMT
1344
+ server: nginx/1.21.6
1345
+ vary: Origin \r\n\r\nHTTP/1.1 200 OK
1346
+ content-type: text/html; charset=utf-8
1347
+ content-length: 211
1348
+ date: Mon, 20 Jan 2025 11:46:34 GMT
1349
+ server: nginx/1.21.6
1350
+ vary: Origin \r\n\r\n" . $ testBody ;
1351
+
1352
+ $ this ->request ->setOutput ($ output );
1353
+
1354
+ $ response = $ this ->request ->request ('GET ' , 'http://example.com ' , [
1355
+ 'allow_redirects ' => true ,
1356
+ ]);
1357
+
1358
+ $ this ->assertSame (200 , $ response ->getStatusCode ());
1359
+
1360
+ $ this ->assertSame ($ testBody , $ response ->getBody ());
1361
+ }
1316
1362
}
0 commit comments