Differential D14226 Diff 34354 src/applications/harbormaster/step/HarbormasterHTTPRequestBuildStepImplementation.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/harbormaster/step/HarbormasterHTTPRequestBuildStepImplementation.php
Show First 20 Lines • Show All 69 Lines • ▼ Show 20 Lines | public function execute( | ||||
$this->resolveFutures( | $this->resolveFutures( | ||||
$build, | $build, | ||||
$build_target, | $build_target, | ||||
array($future)); | array($future)); | ||||
list($status, $body, $headers) = $future->resolve(); | list($status, $body, $headers) = $future->resolve(); | ||||
$header_lines = array(); | $header_lines = array(); | ||||
// TODO: We don't currently preserve the entire "HTTP" response header, but | |||||
// should. Once we do, reproduce it here faithfully. | |||||
$status_code = $status->getStatusCode(); | |||||
$header_lines[] = "HTTP {$status_code}"; | |||||
foreach ($headers as $header) { | foreach ($headers as $header) { | ||||
list($head, $tail) = $header; | list($head, $tail) = $header; | ||||
$header_lines[] = "{$head}: {$tail}"; | $header_lines[] = "{$head}: {$tail}"; | ||||
} | } | ||||
$header_lines = implode("\n", $header_lines); | $header_lines = implode("\n", $header_lines); | ||||
$build_target | $build_target | ||||
->newLog($uri, 'http.head') | ->newLog($uri, 'http.head') | ||||
->append($header_lines); | ->append($header_lines); | ||||
$build_target | $build_target | ||||
->newLog($uri, 'http.body') | ->newLog($uri, 'http.body') | ||||
->append($body); | ->append($body); | ||||
if ($status->getStatusCode() != 200) { | if ($status->isError()) { | ||||
throw new HarbormasterBuildFailureException(); | throw new HarbormasterBuildFailureException(); | ||||
} | } | ||||
} | } | ||||
public function getFieldSpecifications() { | public function getFieldSpecifications() { | ||||
return array( | return array( | ||||
'uri' => array( | 'uri' => array( | ||||
'name' => pht('URI'), | 'name' => pht('URI'), | ||||
Show All 24 Lines |