From cd0b6fba92f65faf38b4694e1ca8f63a30d5ecf7 Mon Sep 17 00:00:00 2001 From: Kimura Youichi Date: Sun, 7 Apr 2013 02:17:54 +0900 Subject: [PATCH] =?utf8?q?API=E3=83=AC=E3=82=B9=E3=83=9D=E3=83=B3=E3=82=B9?= =?utf8?q?=E3=81=AB=E4=BB=98=E3=81=8F=E3=83=AC=E3=83=BC=E3=83=88=E3=83=AA?= =?utf8?q?=E3=83=9F=E3=83=83=E3=83=88=E9=96=A2=E9=80=A3=E3=81=AE=E3=83=98?= =?utf8?q?=E3=83=83=E3=83=80=E5=90=8D=E3=81=8C=E5=B0=8F=E6=96=87=E5=AD=97?= =?utf8?q?=E3=81=AB=E5=A4=89=E3=82=8F=E3=81=A3=E3=81=9F=E3=81=AE=E3=81=A7?= =?utf8?q?=E5=AF=BE=E5=BF=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- OpenTween.Tests/Api/TwitterApiStatusTest.cs | 10 +++++++++- OpenTween/Connection/HttpConnection.cs | 18 +++++++----------- OpenTween/Connection/HttpTwitter.cs | 2 +- OpenTween/Resources/ChangeLog.txt | 1 + 4 files changed, 18 insertions(+), 13 deletions(-) diff --git a/OpenTween.Tests/Api/TwitterApiStatusTest.cs b/OpenTween.Tests/Api/TwitterApiStatusTest.cs index a1a36dd7..508a3aba 100644 --- a/OpenTween.Tests/Api/TwitterApiStatusTest.cs +++ b/OpenTween.Tests/Api/TwitterApiStatusTest.cs @@ -57,7 +57,15 @@ namespace OpenTween.Api new ApiLimit(150, 100, new DateTime(2013, 1, 1, 0, 0, 0, DateTimeKind.Utc).ToLocalTime()), }, new object[] { - new Dictionary { + new Dictionary(StringComparer.OrdinalIgnoreCase) { + {"x-ratelimit-limit", "150"}, + {"x-ratelimit-remaining", "100"}, + {"x-ratelimit-reset", "1356998400"}, + }, + new ApiLimit(150, 100, new DateTime(2013, 1, 1, 0, 0, 0, DateTimeKind.Utc).ToLocalTime()), + }, + new object[] { + new Dictionary(StringComparer.OrdinalIgnoreCase) { {"X-RateLimit-Limit", "150"}, {"X-RateLimit-Remaining", "100"}, {"X-RateLimit-Reset", "hogehoge"}, diff --git a/OpenTween/Connection/HttpConnection.cs b/OpenTween/Connection/HttpConnection.cs index c435a30d..8aa22d7c 100644 --- a/OpenTween/Connection/HttpConnection.cs +++ b/OpenTween/Connection/HttpConnection.cs @@ -534,18 +534,14 @@ namespace OpenTween if (headerInfo.Count > 0) { - string[] keys = new string[headerInfo.Count]; - headerInfo.Keys.CopyTo(keys, 0); - foreach (string key in keys) + var headers = webResponse.Headers; + var dictKeys = new string[headerInfo.Count]; + headerInfo.Keys.CopyTo(dictKeys, 0); + + foreach (var key in dictKeys) { - if (Array.IndexOf(webResponse.Headers.AllKeys, key) > -1) - { - headerInfo[key] = webResponse.Headers[key]; - } - else - { - headerInfo[key] = ""; - } + var value = headers[key]; + headerInfo[key] = value ?? ""; } } diff --git a/OpenTween/Connection/HttpTwitter.cs b/OpenTween/Connection/HttpTwitter.cs index 94285c2f..cd585055 100644 --- a/OpenTween/Connection/HttpTwitter.cs +++ b/OpenTween/Connection/HttpTwitter.cs @@ -65,7 +65,7 @@ namespace OpenTween private static string tks = ""; private static string un = ""; - private Dictionary apiStatusHeaders = new Dictionary + private Dictionary apiStatusHeaders = new Dictionary(StringComparer.OrdinalIgnoreCase) { {"X-Access-Level", ""}, {"X-RateLimit-Limit", ""}, diff --git a/OpenTween/Resources/ChangeLog.txt b/OpenTween/Resources/ChangeLog.txt index d6749952..309b3a27 100644 --- a/OpenTween/Resources/ChangeLog.txt +++ b/OpenTween/Resources/ChangeLog.txt @@ -7,6 +7,7 @@ * FIX: プロフィール画像・サムネイルの表示切り替え時にエラーが起きる場合がある問題を修正 * FIX: タイムライン上のアイコンが空白のまま表示されない場合がある問題を修正 (thx @5px!) * FIX: アカウント追加時の初回認証に失敗する問題を修正 (thx @polka_roco_!) + * FIX: ツールバー上のAPIレートリミット表示が正しく動作しなくなった問題を修正 ==== Ver 1.0.9-beta1(2013/02/08) * ベータ版です -- 2.11.0