From 830f8d0241ac1000c6ad1ee2903d8e728af64902 Mon Sep 17 00:00:00 2001 From: Fabian Keil Date: Sun, 13 Feb 2011 15:19:42 +0100 Subject: [PATCH 1/3] If loading the comments failed, include the httpreason in the error message Helps to figure out if the request was rejected by the server or a local proxy. --- src/comments.c | 3 ++- src/net.c | 3 +++ src/update.c | 1 + src/update.h | 1 + 4 files changed, 7 insertions(+), 1 deletions(-) diff --git a/src/comments.c b/src/comments.c index b1e3ef9..0fdf064 100644 --- a/src/comments.c +++ b/src/comments.c @@ -169,7 +169,8 @@ comments_process_update_result (const struct updateResult * const result, gpoint commentFeed->error = NULL; if ((result->httpstatus < 200) || (result->httpstatus >= 400)) { - commentFeed->error = g_strdup (network_strerror (result->returncode, result->httpstatus)); + const char *error_description = network_strerror (result->returncode, result->httpstatus); + commentFeed->error = g_strdup_printf ( "%s: %s", error_description, result->httpreason); } /* clean up... */ diff --git a/src/net.c b/src/net.c index 336b81b..7846e71 100644 --- a/src/net.c +++ b/src/net.c @@ -64,7 +64,10 @@ network_process_callback (SoupSession *session, SoupMessage *msg, gpointer user_ job->result->returncode = 0; } + job->result->httpreason = g_strdup (msg->reason_phrase); + debug1 (DEBUG_NET, "download status code: %d", msg->status_code); + debug1 (DEBUG_NET, "download status reason: %s", msg->reason_phrase); debug1 (DEBUG_NET, "source after download: >>>%s<<<\n", job->result->source); job->result->data = g_memdup (msg->response_body->data, msg->response_body->length+1); diff --git a/src/update.c b/src/update.c index a961070..acbe2b7 100644 --- a/src/update.c +++ b/src/update.c @@ -181,6 +181,7 @@ update_result_free (updateResultPtr result) update_state_free (result->updateState); + g_free (result->httpreason); g_free (result->data); g_free (result->source); g_free (result->contentType); diff --git a/src/update.h b/src/update.h index 017dc07..1e5cdaf 100644 --- a/src/update.h +++ b/src/update.h @@ -115,6 +115,7 @@ typedef struct updateResult { int returncode; /**< Download status (0=success, otherwise error) */ int httpstatus; /**< HTTP status. Set to 200 for any valid command, file access, etc.... Set to 0 for unknown */ + gchar *httpreason; /**< HTTP reason associated with the status. Set to NULL for unknown */ gchar *data; /**< Downloaded data */ size_t size; /**< Size of downloaded data */ gchar *contentType; /**< Content type of received data */ -- 1.7.5.2 From 49f8a21c22cb3a448878a5d0a7f0655661c5fde6 Mon Sep 17 00:00:00 2001 From: Fabian Keil Date: Sun, 13 Feb 2011 16:38:16 +0100 Subject: [PATCH 2/3] In htmlview_render_item(), don't try to escape non-existant baseURLs. Silences an assertion. --- src/htmlview.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) diff --git a/src/htmlview.c b/src/htmlview.c index e17965c..882cc1e 100644 --- a/src/htmlview.c +++ b/src/htmlview.c @@ -212,7 +212,9 @@ htmlview_render_item (itemPtr item, /* don't use node from htmlView_priv as this would be wrong for folders and other merged item sets */ node = node_from_id (item->nodeId); - baseUrl = common_uri_escape (node_get_base_url (node)); + baseUrl = node_get_base_url (node); + if (baseUrl != NULL) + baseUrl = common_uri_escape (baseUrl); /* do the XML serialization */ doc = itemset_to_xml (node); -- 1.7.5.2 From 9bb14c5546644b6a2bc9783267afa425f4916e39 Mon Sep 17 00:00:00 2001 From: Fabian Keil Date: Sat, 2 Apr 2011 15:28:05 +0200 Subject: [PATCH 3/3] Show the number of unread items before the feed title --- src/ui/ui_node.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ui/ui_node.c b/src/ui/ui_node.c index acc6d28..c49ac35 100644 --- a/src/ui/ui_node.c +++ b/src/ui/ui_node.c @@ -305,8 +305,8 @@ ui_node_update (const gchar *nodeId) NODE_CAPABILITY_SHOW_ITEM_COUNT: /* treat like show unread count */ case NODE_CAPABILITY_SHOW_UNREAD_COUNT: - label = g_markup_printf_escaped ("%s (%u)", - node_get_title(node), node->unreadCount); + label = g_markup_printf_escaped ("%u - %s", + node->unreadCount, node_get_title(node)); break; case NODE_CAPABILITY_SHOW_ITEM_COUNT: label = g_markup_printf_escaped ("%s (%u)", node_get_title(node), node->itemCount); -- 1.7.5.2