private function assertSignature($expect, HTTPSFuture $signed) { $authorization = null; foreach ($signed->getHeaders() as $header) { list($key, $value) = $header; if (phutil_utf8_strtolower($key) === 'authorization') { $authorization = $value; break; } } $expect = str_replace("\n\n", ' ', $expect); $expect = str_replace("\n", '', $expect); $this->assertEqual($expect, $authorization); }
private function getCanonicalHeaderMap(HTTPSFuture $future) { $headers = $future->getHeaders(); $headers[] = array('Host', $this->getHost($future)); $header_map = array(); foreach ($headers as $header) { list($key, $value) = $header; $key = phutil_utf8_strtolower($key); $header_map[$key] = $value; } ksort($header_map); return $header_map; }