changeset 263:b2c64cd550da

added error check code for testing in got_page_cb().
author Yoshiki Yazawa <yaz@honeyplanet.jp>
date Thu, 04 Dec 2008 02:03:35 +0900
parents e9a7c018a952
children b7ac562d758c
files icon.c
diffstat 1 files changed, 16 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/icon.c	Thu Dec 04 00:18:38 2008 +0900
+++ b/icon.c	Thu Dec 04 02:03:35 2008 +0900
@@ -187,6 +187,18 @@
         return;
     }
 
+    /* if we receive bad response */
+    if(!strstr(url_text, "HTTP/1.1 200 OK") &&
+       !strstr(url_text, "HTTP/1.0 200 OK")) {
+        if(data) {
+            data->requested = FALSE;
+            data->fetch_data = NULL;
+        }
+        g_free(gotdata->user_name);
+        g_free(gotdata);
+        return;
+    }
+
     /* setup image url */ /* xxx need simplify --yaz */
     g_regex_match(regp[regp_id], url_text, 0, &match_info);
     if(!g_match_info_matches(match_info)) {
@@ -198,11 +210,13 @@
             url = g_strdup(TWITTER_DEFAULT_ICON_URL);
         }
         else if(service == identica_service) {
-            twitter_debug("fall back to identica default icon\n");
+            twitter_debug("fall back to identica default icon: %s\n",
+                          gotdata->user_name);
             url = g_strdup(IDENTICA_DEFAULT_ICON_URL);
         }
         else if(service == jisko_service) {
-            twitter_debug("fall back to jisko default icon\n");
+            twitter_debug("fall back to jisko default icon: %s\n",
+                          gotdata->user_name);
             url = g_strdup(JISKO_DEFAULT_ICON_URL);
         }
         else {