From c336f176e3ed872fe7bff1fb82f31b38d0d88aff Mon Sep 17 00:00:00 2001 From: Nico Hoffmann Date: Sat, 11 May 2024 14:32:46 +0200 Subject: [PATCH] Add test case for `HTTP_CF_CONNECTING_IP ` --- tests/Api/UploadTest.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/tests/Api/UploadTest.php b/tests/Api/UploadTest.php index f5fbefeaed..d6775ed9ab 100644 --- a/tests/Api/UploadTest.php +++ b/tests/Api/UploadTest.php @@ -256,8 +256,19 @@ public function testChunkSize() Upload::chunkSize() ); + // with CloudFlare + ini_set('upload_max_filesize', '200M'); + ini_set('post_max_size', '200M'); + $_SERVER['HTTP_CF_CONNECTING_IP'] = '1.1.1.1'; + + $this->assertSame( + (int)floor(100 * 1024 * 1024 * 0.95), + Upload::chunkSize() + ); + ini_restore('upload_max_filesize'); ini_restore('post_max_size'); + unset($_SERVER['HTTP_CF_CONNECTING_IP']); } /**