[Routing] Revert throwing 405 on missed slash/scheme redirections
This commit is contained in:
parent
25f3eb5cdd
commit
391b01393d
@ -264,7 +264,6 @@ EOF;
|
|||||||
if ('/' === substr(\$pathinfo, -1)) {
|
if ('/' === substr(\$pathinfo, -1)) {
|
||||||
// no-op
|
// no-op
|
||||||
} elseif (!in_array(\$this->context->getMethod(), array('HEAD', 'GET'))) {
|
} elseif (!in_array(\$this->context->getMethod(), array('HEAD', 'GET'))) {
|
||||||
\$allow[] = 'GET';
|
|
||||||
goto $gotoname;
|
goto $gotoname;
|
||||||
} else {
|
} else {
|
||||||
return \$this->redirect(\$rawPathinfo.'/', '$name');
|
return \$this->redirect(\$rawPathinfo.'/', '$name');
|
||||||
@ -283,7 +282,6 @@ EOF;
|
|||||||
\$requiredSchemes = $schemes;
|
\$requiredSchemes = $schemes;
|
||||||
if (!isset(\$requiredSchemes[\$this->context->getScheme()])) {
|
if (!isset(\$requiredSchemes[\$this->context->getScheme()])) {
|
||||||
if (!in_array(\$this->context->getMethod(), array('HEAD', 'GET'))) {
|
if (!in_array(\$this->context->getMethod(), array('HEAD', 'GET'))) {
|
||||||
\$allow[] = 'GET';
|
|
||||||
goto $gotoname;
|
goto $gotoname;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -69,7 +69,6 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec
|
|||||||
if ('/' === substr($pathinfo, -1)) {
|
if ('/' === substr($pathinfo, -1)) {
|
||||||
// no-op
|
// no-op
|
||||||
} elseif (!in_array($this->context->getMethod(), array('HEAD', 'GET'))) {
|
} elseif (!in_array($this->context->getMethod(), array('HEAD', 'GET'))) {
|
||||||
$allow[] = 'GET';
|
|
||||||
goto not_baz3;
|
goto not_baz3;
|
||||||
} else {
|
} else {
|
||||||
return $this->redirect($rawPathinfo.'/', 'baz3');
|
return $this->redirect($rawPathinfo.'/', 'baz3');
|
||||||
@ -86,7 +85,6 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec
|
|||||||
if ('/' === substr($pathinfo, -1)) {
|
if ('/' === substr($pathinfo, -1)) {
|
||||||
// no-op
|
// no-op
|
||||||
} elseif (!in_array($this->context->getMethod(), array('HEAD', 'GET'))) {
|
} elseif (!in_array($this->context->getMethod(), array('HEAD', 'GET'))) {
|
||||||
$allow[] = 'GET';
|
|
||||||
goto not_baz4;
|
goto not_baz4;
|
||||||
} else {
|
} else {
|
||||||
return $this->redirect($rawPathinfo.'/', 'baz4');
|
return $this->redirect($rawPathinfo.'/', 'baz4');
|
||||||
@ -185,7 +183,6 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec
|
|||||||
if ('/' === substr($pathinfo, -1)) {
|
if ('/' === substr($pathinfo, -1)) {
|
||||||
// no-op
|
// no-op
|
||||||
} elseif (!in_array($this->context->getMethod(), array('HEAD', 'GET'))) {
|
} elseif (!in_array($this->context->getMethod(), array('HEAD', 'GET'))) {
|
||||||
$allow[] = 'GET';
|
|
||||||
goto not_hey;
|
goto not_hey;
|
||||||
} else {
|
} else {
|
||||||
return $this->redirect($rawPathinfo.'/', 'hey');
|
return $this->redirect($rawPathinfo.'/', 'hey');
|
||||||
@ -337,7 +334,6 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec
|
|||||||
$requiredSchemes = array ( 'https' => 0,);
|
$requiredSchemes = array ( 'https' => 0,);
|
||||||
if (!isset($requiredSchemes[$this->context->getScheme()])) {
|
if (!isset($requiredSchemes[$this->context->getScheme()])) {
|
||||||
if (!in_array($this->context->getMethod(), array('HEAD', 'GET'))) {
|
if (!in_array($this->context->getMethod(), array('HEAD', 'GET'))) {
|
||||||
$allow[] = 'GET';
|
|
||||||
goto not_secure;
|
goto not_secure;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -353,7 +349,6 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec
|
|||||||
$requiredSchemes = array ( 'http' => 0,);
|
$requiredSchemes = array ( 'http' => 0,);
|
||||||
if (!isset($requiredSchemes[$this->context->getScheme()])) {
|
if (!isset($requiredSchemes[$this->context->getScheme()])) {
|
||||||
if (!in_array($this->context->getMethod(), array('HEAD', 'GET'))) {
|
if (!in_array($this->context->getMethod(), array('HEAD', 'GET'))) {
|
||||||
$allow[] = 'GET';
|
|
||||||
goto not_nonsecure;
|
goto not_nonsecure;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -19,14 +19,6 @@ use Symfony\Component\Routing\RequestContext;
|
|||||||
|
|
||||||
class DumpedRedirectableUrlMatcherTest extends RedirectableUrlMatcherTest
|
class DumpedRedirectableUrlMatcherTest extends RedirectableUrlMatcherTest
|
||||||
{
|
{
|
||||||
/**
|
|
||||||
* @expectedException \Symfony\Component\Routing\Exception\MethodNotAllowedException
|
|
||||||
*/
|
|
||||||
public function testRedirectWhenNoSlashForNonSafeMethod()
|
|
||||||
{
|
|
||||||
parent::testRedirectWhenNoSlashForNonSafeMethod();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function getUrlMatcher(RouteCollection $routes, RequestContext $context = null)
|
protected function getUrlMatcher(RouteCollection $routes, RequestContext $context = null)
|
||||||
{
|
{
|
||||||
static $i = 0;
|
static $i = 0;
|
||||||
|
Reference in New Issue
Block a user