1
1
Fork 0
mirror of https://code.mensbeam.com/MensBeam/Arsse.git synced 2024-12-22 13:12:41 +00:00

Be explicit with HTTP challenge character encoding

This commit is contained in:
J. King 2019-09-27 17:16:34 -04:00
parent c5337b37b4
commit 5f993187ea
3 changed files with 4 additions and 3 deletions

View file

@ -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

View file

@ -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 {

View file

@ -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);
}