+ fclose(info->fp);
+ g_free(info);
+ //g_object_unref(session); This is probably leaking
+}
+
+void chunk_cb(SoupMessage *message, SoupBuffer *chunk, gpointer _info)
+{
+ cache_file_end_t *info = _info;
+ if (!SOUP_STATUS_IS_SUCCESSFUL(message->status_code))
+ return;
+
+ if (!fwrite(chunk->data, chunk->length, 1, info->fp))
+ g_error("data: chunk_cb - Unable to write data");
+ goffset cur = ftell(info->fp);
+ //goffset total = soup_message_headers_get_range(message->response_headers);
+ goffset start=0, end=0, total=0;
+ soup_message_headers_get_content_range(message->response_headers,
+ &start, &end, &total);
+
+ if (info->user_chunk_cb)
+ info->user_chunk_cb(info->local, cur, total, info->user_data);