# HG changeset patch # User Daniel Atallah # Date 1137473479 0 # Node ID 5e338dda872f11dc6558cc613305d72a0bee2f48 # Parent 540d13050d5aa45c2bc2be2f51670b9e5ce9315c [gaim-migrate @ 15260] (try to) continue reading after getting the headers committer: Tailor Script diff -r 540d13050d5a -r 5e338dda872f src/util.c --- a/src/util.c Tue Jan 17 04:43:07 2006 +0000 +++ b/src/util.c Tue Jan 17 04:51:19 2006 +0000 @@ -3106,39 +3106,39 @@ /* If we're returning the headers too, we don't need to clean them out */ if (gfud->include_headers) { gfud->data_len = content_len + header_len; - return; + } else { + + if (gfud->len > (header_len + 1)) + body_len = (gfud->len - header_len); + + + new_data = g_try_malloc(content_len); + if (new_data == NULL) { + gaim_debug_error("gaim_url_fetch", "Failed to allocate %u bytes: %s\n", + content_len, strerror(errno)); + gaim_input_remove(gfud->inpa); + close(sock); + gfud->callback(gfud->user_data, NULL, 0); + destroy_fetch_url_data(gfud); + + return; + } + + /* We may have read part of the body when reading the headers, don't lose it */ + if (body_len > 0) { + tmp += 4; + memcpy(new_data, tmp, body_len); + } + + /* Out with the old... */ + g_free(gfud->webdata); + gfud->webdata = NULL; + + /* In with the new. */ + gfud->len = body_len; + gfud->data_len = content_len; + gfud->webdata = new_data; } - - if (gfud->len > (header_len + 1)) - body_len = (gfud->len - header_len); - - - new_data = g_try_malloc(content_len); - if (new_data == NULL) { - gaim_debug_error("gaim_url_fetch", "Failed to allocate %u bytes: %s\n", - content_len, strerror(errno)); - gaim_input_remove(gfud->inpa); - close(sock); - gfud->callback(gfud->user_data, NULL, 0); - destroy_fetch_url_data(gfud); - - return; - } - - /* We may have read part of the body when reading the headers, don't lose it */ - if (body_len > 0) { - tmp += 4; - memcpy(new_data, tmp, body_len); - } - - /* Out with the old... */ - g_free(gfud->webdata); - gfud->webdata = NULL; - - /* In with the new. */ - gfud->len = body_len; - gfud->data_len = content_len; - gfud->webdata = new_data; } }