diff --git a/CHANGELOG b/CHANGELOG index 153dfeb5..3e48ece9 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -6,6 +6,7 @@ Bug fixes: - Don't fail adding a feed which collides with another via redirection - Don't fail on very long text-search queries containing question marks when using PostgreSQL or MySQL +- Specify HTTP authentication encoding as UTF-8 Changes: - Include a user manual diff --git a/lib/REST.php b/lib/REST.php index 989205f4..9212326d 100644 --- a/lib/REST.php +++ b/lib/REST.php @@ -150,7 +150,7 @@ class REST { public function challenge(ResponseInterface $res, string $realm = null): ResponseInterface { $realm = $realm ?? Arsse::$conf->httpRealm; - return $res->withAddedHeader("WWW-Authenticate", 'Basic realm="'.$realm.'"'); + return $res->withAddedHeader("WWW-Authenticate", 'Basic realm="'.$realm.'", charset="UTF-8"'); } public function normalizeResponse(ResponseInterface $res, RequestInterface $req = null): ResponseInterface { diff --git a/tests/cases/REST/TestREST.php b/tests/cases/REST/TestREST.php index 994d6ac5..fb0dc2f7 100644 --- a/tests/cases/REST/TestREST.php +++ b/tests/cases/REST/TestREST.php @@ -97,10 +97,10 @@ class TestREST extends \JKingWeb\Arsse\Test\AbstractTest { self::setConf(); $r = new REST(); $in = new EmptyResponse(401); - $exp = $in->withHeader("WWW-Authenticate", 'Basic realm="OOK"'); + $exp = $in->withHeader("WWW-Authenticate", 'Basic realm="OOK", charset="UTF-8"'); $act = $r->challenge($in, "OOK"); $this->assertMessage($exp, $act); - $exp = $in->withHeader("WWW-Authenticate", 'Basic realm="'.Arsse::$conf->httpRealm.'"'); + $exp = $in->withHeader("WWW-Authenticate", 'Basic realm="'.Arsse::$conf->httpRealm.'", charset="UTF-8"'); $act = $r->challenge($in); $this->assertMessage($exp, $act); }