Skip to content

Commit

Permalink
Merge remote branch 'origin/3.1/develop' into 3.1/develop
Browse files Browse the repository at this point in the history
  • Loading branch information
zombor committed Mar 13, 2011
2 parents e943502 + d6d8665 commit 73b9a36
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 4 deletions.
6 changes: 3 additions & 3 deletions classes/kohana/request.php
Expand Up @@ -724,9 +724,6 @@ public function __construct($uri, Cache $cache = NULL, $injected_routes = array(
// Initialise the header
$this->_header = new HTTP_Header(array());

// Remove trailing slashes from the URI
$uri = trim($uri, '/');

// Assign injected routes
$this->_injected_routes = $injected_routes;

Expand All @@ -736,6 +733,9 @@ public function __construct($uri, Cache $cache = NULL, $injected_routes = array(
*/
if (strpos($uri, '://') === FALSE)
{
// Remove trailing slashes from the URI
$uri = trim($uri, '/');

$processed_uri = Request::process_uri($uri, $this->_injected_routes);

if ($processed_uri === NULL)
Expand Down
43 changes: 42 additions & 1 deletion tests/kohana/RequestTest.php
Expand Up @@ -494,4 +494,45 @@ public function test_post_max_size_exceeded($content_length, $expected)
// Test the post_max_size_exceeded() method
$this->assertSame(Request::post_max_size_exceeded(), $expected);
}
}

/**
* Provides data for test_uri_only_trimed_on_internal()
*
* @return array
*/
public function provider_uri_only_trimed_on_internal()
{
return array(
array(
new Request('http://www.google.com'),
'http://www.google.com'
),
array(
new Request('http://www.google.com/'),
'http://www.google.com/'
),
array(
new Request('foo/bar/'),
'foo/bar'
),
array(
new Request('foo/bar'),
'foo/bar'
)
);
}

/**
* Tests that the uri supplied to Request is only trimed
* for internal requests.
*
* @dataProvider provider_uri_only_trimed_on_internal
*
* @return void
*/
public function test_uri_only_trimed_on_internal($request, $expected)
{
$this->assertSame($request->uri(), $expected);
}

} // End Kohana_RequestTest

0 comments on commit 73b9a36

Please sign in to comment.