Changeset View
Changeset View
Standalone View
Standalone View
src/future/http/BaseHTTPFuture.php
Show First 20 Lines • Show All 200 Lines • ▼ Show 20 Lines | /* -( Configuring the Request )-------------------------------------------- */ | ||||
* In either case, an array with all (or all matching) headers is returned. | * In either case, an array with all (or all matching) headers is returned. | ||||
* | * | ||||
* @param string|null Optional filter, which selects only headers with that | * @param string|null Optional filter, which selects only headers with that | ||||
* name if provided. | * name if provided. | ||||
* @return array List of all (or all matching) headers. | * @return array List of all (or all matching) headers. | ||||
* @task config | * @task config | ||||
*/ | */ | ||||
public function getHeaders($filter = null) { | public function getHeaders($filter = null) { | ||||
$filter = strtolower($filter); | if ($filter !== null) { | ||||
$filter = phutil_utf8_strtolower($filter); | |||||
} | |||||
$result = array(); | $result = array(); | ||||
foreach ($this->headers as $header) { | foreach ($this->headers as $header) { | ||||
list($name, $value) = $header; | list($name, $value) = $header; | ||||
if (!$filter || ($filter == strtolower($name))) { | if (($filter === null) || ($filter === phutil_utf8_strtolower($name))) { | ||||
$result[] = $header; | $result[] = $header; | ||||
} | } | ||||
} | } | ||||
return $result; | return $result; | ||||
} | } | ||||
/** | /** | ||||
▲ Show 20 Lines • Show All 236 Lines • Show Last 20 Lines |
Content licensed under Creative Commons Attribution-ShareAlike 4.0 (CC-BY-SA) unless otherwise noted; code licensed under Apache 2.0 or other open source licenses. · CC BY-SA 4.0 · Apache 2.0