1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-19 05:12:41 +01:00

Fix validation of Harbormaster HTTP methods

Summary: Precedence here was mucked up.

Test Plan: Plan with no explicit "method" now defaults to POST correctly.

Reviewers: dctrwatson, btrahan

Reviewed By: btrahan

Subscribers: epriestley

Differential Revision: https://secure.phabricator.com/D8559
This commit is contained in:
epriestley 2014-03-18 12:05:14 -07:00
parent 809e5a0389
commit a2a4f4b3da

View file

@ -59,10 +59,18 @@ final class HarbormasterHTTPRequestBuildStepImplementation
return false;
}
if ($settings['method'] === null || $settings['method'] != '' &&
!in_array ($settings['method'],
array('GET', 'PUT', 'DELETE', 'POST'))) {
return false;
$methods = array(
'GET' => true,
'POST' => true,
'DELETE' => true,
'PUT' => true,
);
$method = idx($settings, 'method');
if (strlen($method)) {
if (empty($methods[$method])) {
return false;
}
}
return true;