OSDN Git Service

・500系エラーの場合はAPI情報を更新しないように変更
authorsyo68k <syo68k@users.sourceforge.jp>
Thu, 2 Sep 2010 15:09:57 +0000 (15:09 +0000)
committerKimura Youichi <kim.upsilon@bucyou.net>
Sat, 18 Feb 2012 14:15:09 +0000 (23:15 +0900)
・コールバック関数の規約変更(HttpStatusCode,Contentを参照できるように。いずれもByRef。ContentはAPIメソッドによってはNothingになることがあるので、Nothingチェックあるいはsenderによるメソッド名チェックを必ず行うこと)

git-svn-id: http://svn.sourceforge.jp/svnroot/tween/trunk@801 e39ad16e-3079-482e-bb30-4b4d378143b6

Tween/Connection/HttpConnectionBasic.vb
Tween/Connection/HttpConnectionOAuth.vb
Tween/Connection/HttpTwitter.vb
Tween/Connection/IHttpConnection.vb

index d7c88df..6f07016 100644 (file)
@@ -59,7 +59,7 @@ Public Class HttpConnectionBasic
             code = GetResponse(webReq, content, headerInfo, False)
         End If
         If callback IsNot Nothing Then
-            callback(Me)
+            callback(Me, code, content)
         End If
         Return code
     End Function
@@ -90,7 +90,7 @@ Public Class HttpConnectionBasic
             code = GetResponse(webReq, content, headerInfo, False)
         End If
         If callback IsNot Nothing Then
-            callback(Me)
+            callback(Me, code, content)
         End If
         Return code
     End Function
index 25fca64..b38550a 100644 (file)
@@ -88,7 +88,7 @@ Public Class HttpConnectionOAuth
             code = GetResponse(webReq, content, headerInfo, False)
         End If
         If callback IsNot Nothing Then
-            callback(Me)
+            callback(Me, code, content)
         End If
         Return code
     End Function
@@ -121,7 +121,7 @@ Public Class HttpConnectionOAuth
             code = GetResponse(webReq, content, headerInfo, False)
         End If
         If callback IsNot Nothing Then
-            callback(Me)
+            callback(Me, code, content)
         End If
         Return code
     End Function
index 348bb58..6476d5e 100644 (file)
@@ -646,7 +646,9 @@ Public Class HttpTwitter
     End Property
 #End Region
 
-    Private Sub GetApiCallback(ByVal sender As Object)
-        TwitterApiInfo.ParseHttpHeaders(TwitterApiInfo.HttpHeaders)
+    Private Sub GetApiCallback(ByVal sender As Object, ByRef code As HttpStatusCode, ByRef content As String)
+        If code < HttpStatusCode.InternalServerError Then
+            TwitterApiInfo.ParseHttpHeaders(TwitterApiInfo.HttpHeaders)
+        End If
     End Sub
 End Class
index 2efbed5..9951b82 100644 (file)
@@ -21,5 +21,5 @@ Public Interface IHttpConnection
     Function Authenticate(ByVal url As Uri, ByVal username As String, ByVal password As String) As HttpStatusCode
 
     ReadOnly Property AuthUsername() As String
-    Delegate Sub CallbackDelegate(ByVal sender As Object)
+    Delegate Sub CallbackDelegate(ByVal sender As Object, ByRef code As HttpStatusCode, ByRef content As String)
 End Interface