Skip to content

Commit

Permalink
Fixes yiisoft#3548: Fixed the bug that X-Rate-Limit-Remaining header …
Browse files Browse the repository at this point in the history
…is always zero when using RateLimiter
  • Loading branch information
qiangxue committed May 22, 2014
1 parent 1a84845 commit cbf27d1
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions framework/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ Yii Framework 2 Change Log
- Bug #3436: Fixed the issue that `ServiceLocator` still returns the old component after calling `set()` with a new definition (qiangxue)
- Bug #3458: Fixed the bug that the image rendered by `CaptchaAction` was using a wrong content type (MDMunir, qiangxue)
- Bug #3522: Fixed BaseFileHelper::normalizePath to allow a (.) for the current path. (skotos)
- Bug #3548: Fixed the bug that X-Rate-Limit-Remaining header is always zero when using RateLimiter (qiangxue)
- Bug: Fixed inconsistent return of `\yii\console\Application::runAction()` (samdark)
- Enh #2264: `CookieCollection::has()` will return false for expired or removed cookies (qiangxue)
- Enh #2435: `yii\db\IntegrityException` is now thrown on database integrity errors instead of general `yii\db\Exception` (samdark)
Expand Down
2 changes: 1 addition & 1 deletion framework/filters/RateLimiter.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ public function checkRateLimit($user, $request, $response, $action)
throw new TooManyRequestsHttpException($this->errorMessage);
} else {
$user->saveAllowance($request, $action, $allowance - 1, $current);
$this->addRateLimitHeaders($response, $limit, 0, (int) (($limit - $allowance) * $window / $limit));
$this->addRateLimitHeaders($response, $limit, $allowance, (int) (($limit - $allowance) * $window / $limit));
}
}

Expand Down

0 comments on commit cbf27d1

Please sign in to comment.