summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorNathan Gass2025-05-23 09:37:23 +0200
committerNathan Gass2025-05-23 09:37:23 +0200
commit0fc541eee4fe00b93911d7b1b1b4d6a9072889b5 (patch)
tree5988d011759816138f858f6ef14d9c5d0a289375 /test
parent2fd750abdd7b28d8c1ecb8f4a78f8e861d8244e8 (diff)
downloaditools-0fc541eee4fe00b93911d7b1b1b4d6a9072889b5.tar.gz
itools-0fc541eee4fe00b93911d7b1b1b4d6a9072889b5.tar.bz2
itools-0fc541eee4fe00b93911d7b1b1b4d6a9072889b5.zip
add test for maxlength with compression enabled
Diffstat (limited to 'test')
-rw-r--r--test/it_url.testserver.php4
-rwxr-xr-xtest/it_url_slow.t7
2 files changed, 11 insertions, 0 deletions
diff --git a/test/it_url.testserver.php b/test/it_url.testserver.php
index ca5300c..e59a81a 100644
--- a/test/it_url.testserver.php
+++ b/test/it_url.testserver.php
@@ -66,8 +66,12 @@ switch ($_SERVER['PHP_SELF'])
break;
case "/repeat":
+ if ($_REQUEST['compressed'])
+ ob_start('ob_gzhandler');
for ($i = 0; $i < $_REQUEST['num']; $i++)
echo $_REQUEST['string'];
+ if ($_REQUEST['compressed'])
+ ob_end_flush();
break;
case "/empty":
diff --git a/test/it_url_slow.t b/test/it_url_slow.t
index 00bbc2f..a5fd348 100755
--- a/test/it_url_slow.t
+++ b/test/it_url_slow.t
@@ -69,6 +69,13 @@ if (!$res || !$res2)
handle_server(
ok(
+ !it_url::get(['url' => "http://$host/repeat?string=abcdefghijklmnop&num=10&compressed", 'maxlength' => 100, 'retries' => 0, 'it_error' => false]),
+ 'it_url::get() fails for response larger than maxlength even if compressed response is smaller'
+ )
+);
+
+handle_server(
+ ok(
it_url::get(U("http://$host/repeat", ['string' => "abc", 'num' => 1024 * 1024])) == str_repeat("abc", 1024 * 1024),
'it_url::get() handles large response'
)