public function addHeader($name, $value = null) {
        if ($this->canSetHeaders()) {
            if ($value === null) {
                $value = trim(substr($name, strpos($name, ':') + 1));
                $name = trim(substr($name, 0, strpos($name, ':')));
            }

            $this->headers[$name] = $value;
        }
    }