Skip to content

Commit

Permalink
test for offset-parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
indeyets committed Jan 16, 2010
1 parent bdb29a3 commit 1c08f28
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 2 deletions.
4 changes: 2 additions & 2 deletions ext/tests/001-simple.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ Simple HTTP-request
<?php
// empty body
$parser = new HttpParser();
$parser->execute("GET / HTTP/1.1\r\nHost: example.com\r\n\r\n", 0);
$parser->execute("GET / HTTP/1.1\r\nHost: example.com\r\n\r\n");
var_dump($parser->getEnvironment());

// no body (unfinished request)
$parser = new HttpParser();
$parser->execute("GET / HTTP/1.1\r\nHost: example.com\r\n", 0);
$parser->execute("GET / HTTP/1.1\r\nHost: example.com\r\n");
var_dump($parser->getEnvironment());
?>
==DONE==
Expand Down
29 changes: 29 additions & 0 deletions ext/tests/002-offset.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
--TEST--
Simple HTTP-request
--SKIPIF--
<?php if (!extension_loaded("httpparser")) print "skip"; ?>
--FILE--
<?php
// empty body
$parser = new HttpParser();
$nparsed = $parser->execute("testGET / HTTP/1.1\r\nHost: example.com\r\n\r\n", 4);
var_dump($parser->getEnvironment());

?>
==DONE==
--EXPECT--
array(6) {
["REQUEST_METHOD"]=>
string(3) "GET"
["PATH_INFO"]=>
string(1) "/"
["REQUEST_URI"]=>
string(1) "/"
["HTTP_VERSION"]=>
string(8) "HTTP/1.1"
["HTTP_HOST"]=>
string(11) "example.com"
["REQUEST_BODY"]=>
string(0) ""
}
==DONE==

0 comments on commit 1c08f28

Please sign in to comment.