Skip to content

Commit

Permalink
Merge pull request #70 from fruux/basic-auth-utf8
Browse files Browse the repository at this point in the history
Sending encoding="UTF-8" on basic auth challenges.
  • Loading branch information
evert authored Oct 24, 2016
2 parents 7904e68 + 63641e0 commit 09d7598
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ ChangeLog
to `CLI`.
* The HTTP response is now initialized with HTTP code `500` instead of `null`,
so if it's not changed, it will be emitted as 500.
* #69: Sending `charset="UTF-8"` on Basic authentiation challenges per
[rfc7617][rfc7617].


4.2.1 (2016-01-06)
Expand Down Expand Up @@ -268,4 +270,5 @@ Before 2.0.0, this package was built-into SabreDAV, where it first appeared in
January 2009.

[psr-http]: https://github.com/php-fig/fig-standards/blob/master/proposed/http-message.md
[rfc-7240]: http://tools.ietf.org/html/rfc7240
[rfc7240]: http://tools.ietf.org/html/rfc7240
[rfc7617]: https://tools.ietf.org/html/rfc7617
2 changes: 1 addition & 1 deletion lib/Auth/Basic.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ function getCredentials() {
*/
function requireLogin() {

$this->response->addHeader('WWW-Authenticate', 'Basic realm="' . $this->realm . '"');
$this->response->addHeader('WWW-Authenticate', 'Basic realm="' . $this->realm . '", charset="UTF-8"');
$this->response->setStatus(401);

}
Expand Down
2 changes: 1 addition & 1 deletion tests/HTTP/Auth/BasicTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ function testRequireLogin() {

$basic->requireLogin();

$this->assertEquals('Basic realm="Dagger"', $response->getHeader('WWW-Authenticate'));
$this->assertEquals('Basic realm="Dagger", charset="UTF-8"', $response->getHeader('WWW-Authenticate'));
$this->assertEquals(401, $response->getStatus());

}
Expand Down

0 comments on commit 09d7598

Please sign in to comment.