# HG changeset patch # User Paul Aurich # Date 1242940157 0 # Node ID f82f3dc29f9b02284291ef06f60c8aa62cd9754d # Parent fdd2952d86399a166077782f351742f08ebb2c64 Don't try to process BOSH packet if there's no data (avoid a purple_strcasestr assertion). Also print friendlier error messages. diff -r fdd2952d8639 -r f82f3dc29f9b libpurple/protocols/jabber/bosh.c --- a/libpurple/protocols/jabber/bosh.c Thu May 21 20:18:10 2009 +0000 +++ b/libpurple/protocols/jabber/bosh.c Thu May 21 21:09:17 2009 +0000 @@ -301,7 +301,7 @@ return; } - packet = g_string_new(""); + packet = g_string_new(NULL); g_string_printf(packet, "buf) - conn->buf = g_string_new(""); + conn->buf = g_string_new(NULL); /* Read once to prime cnt before the loop */ if (conn->psc) @@ -705,7 +705,8 @@ if (cnt == 0 || (cnt < 0 && errno != EAGAIN)) { if (cnt < 0) - purple_debug_info("jabber", "bosh read=%d, errno=%d\n", cnt, errno); + purple_debug_info("jabber", "bosh read=%d, errno=%d, error=%s\n", + cnt, errno, g_strerror(errno)); else purple_debug_info("jabber", "bosh server closed the connection\n"); @@ -718,8 +719,8 @@ /* Process what we do have */ } - - jabber_bosh_http_connection_process(conn); + if (conn->buf->len > 0) + jabber_bosh_http_connection_process(conn); } static void