summaryrefslogtreecommitdiff
path: root/_test
diff options
context:
space:
mode:
authorAndreas Gohr <andi@splitbrain.org>2012-07-06 10:50:14 +0200
committerAndreas Gohr <andi@splitbrain.org>2012-07-06 10:50:14 +0200
commitef718d793ca8b386f513915034a14bd05dc310a0 (patch)
tree59b73d159fc60238f48bed65b2f68a8ac7311dda /_test
parent15f8c9026e596167a72c7d3abaf00621599a5713 (diff)
parent08118f511f456cc119c08a966a83704af88e6182 (diff)
downloadrpg-ef718d793ca8b386f513915034a14bd05dc310a0.tar.gz
rpg-ef718d793ca8b386f513915034a14bd05dc310a0.tar.bz2
Merge branch 'httpclient' of git://github.com/whoopdedo/dokuwiki into pull-request-107
* 'httpclient' of git://github.com/whoopdedo/dokuwiki: Adjust unit test to reflect desired behavior of max_bodysize Avoid timeout when content-length is 0 Limit size of reads when max_bodysize is set or content-length is present Skip over chunk extensions that nobody uses because RFC2616 says so HTTPClient will read up to max_bodysize if it can Validate the size of a chunk before reading from the socket Efficiently wait on sockets HTTP headers are already parsed, there is no need for regexp Utility function for writing to a socket Unit test for HTTPClient chunked encoding Utility functions for reading from a socket. Raise an exception on socket errors. Correct handling of chunked transfer encoding. (FS#2535) Avoid strict warnings about unset array keys. Reference static variable through 'self::' as you're supposed to.
Diffstat (limited to '_test')
-rw-r--r--_test/tests/inc/httpclient_http.test.php15
1 files changed, 15 insertions, 0 deletions
diff --git a/_test/tests/inc/httpclient_http.test.php b/_test/tests/inc/httpclient_http.test.php
index 9cae3736a..9959a1f06 100644
--- a/_test/tests/inc/httpclient_http.test.php
+++ b/_test/tests/inc/httpclient_http.test.php
@@ -124,6 +124,11 @@ class httpclient_http_test extends DokuWikiTest {
$http->max_bodysize = 250;
$data = $http->get($this->server.'/stream/30');
$this->assertTrue($data === false, 'HTTP response');
+ $http->max_bodysize_abort = false;
+ $data = $http->get($this->server.'/stream/30');
+ $this->assertFalse($data === false, 'HTTP response');
+ /* should read no more than max_bodysize+1 */
+ $this->assertLessThanOrEqual(251,strlen($data));
}
/**
@@ -176,5 +181,15 @@ class httpclient_http_test extends DokuWikiTest {
$this->assertArrayHasKey('foo',$http->resp_headers);
$this->assertEquals('bar',$http->resp_headers['foo']);
}
+
+ /**
+ * @group internet
+ */
+ function test_chunked(){
+ $http = new HTTPClient();
+ $data = $http->get('http://whoopdedo.org/cgi-bin/chunked/2550');
+ $this->assertFalse($data === false, 'HTTP response');
+ $this->assertEquals(2550,strlen($data));
+ }
}
//Setup VIM: ex: et ts=4 :