Merge pull request #250 from sminnee/form-head-request-throws-500

Return 404 rather than 500 on bad actions in requesthandler
This commit is contained in:
Ingo Schommer 2012-03-22 12:45:12 -07:00
commit 0ad6fe7ec1
2 changed files with 4 additions and 2 deletions

View File

@ -162,12 +162,15 @@ class RequestHandler extends ViewableData {
}
try {
if(!$this->hasMethod($action)) {
return $this->httpError(404, "Action '$action' isn't available on class " . get_class($this) . ".");
}
$result = $this->$action($request);
} catch(SS_HTTPResponse_Exception $responseException) {
$result = $responseException->getResponse();
}
} else {
return $this->httpError(403, "Action '$action' isn't allowed on class $this->class");
return $this->httpError(403, "Action '$action' isn't allowed on class " . get_class($this) . ".");
}
if($result instanceof SS_HTTPResponse && $result->isError()) {

View File

@ -189,7 +189,6 @@ class Form extends RequestHandler {
static $url_handlers = array(
'field/$FieldName!' => 'handleField',
'$Action!' => 'handleAction',
'POST ' => 'httpSubmission',
'GET ' => 'httpSubmission',
'HEAD ' => 'httpSubmission',