public function applyCookie($req)
    {
        // fetch cookies
        $host = $req->getHeader('host');
        $path = $req->getUrlParam('path');
        $cookies = $this->fetchCookieToSend($host, $path);
        if ($this !== $req) {
            $cookies = array_merge($cookies, $req->fetchCookieToSend($host, $path));
        }
        // add to header
        $req->setHeader('cookie', null);
        foreach (array_chunk(array_values($cookies), 3) as $chunk) {
            $req->addHeader('cookie', implode('; ', $chunk));
        }
    }