From f6ac059a05b65bd9e93ba59fd932e3f8568a250a Mon Sep 17 00:00:00 2001 From: John Mark Bell Date: Thu, 8 Sep 2011 08:26:16 +0000 Subject: Handle zero-length documents correctly svn path=/trunk/netsurf/; revision=12778 --- content/hlcache.c | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) (limited to 'content/hlcache.c') diff --git a/content/hlcache.c b/content/hlcache.c index 38ec18eb6..cbdb8ad1e 100644 --- a/content/hlcache.c +++ b/content/hlcache.c @@ -491,9 +491,26 @@ nserror hlcache_llcache_callback(llcache_handle *handle, break; case LLCACHE_EVENT_DONE: /* DONE event before we could determine the effective MIME type. - * Treat this as an error. */ - /* Fall through */ + error = mimesniff_compute_effective_type(handle, + NULL, 0, false, &effective_type); + if (error == NSERROR_OK) { + error = hlcache_migrate_ctx(ctx, effective_type); + + lwc_string_unref(effective_type); + + return error; + } + + if (ctx->handle->cb != NULL) { + hlcache_event hlevent; + + hlevent.type = CONTENT_MSG_ERROR; + hlevent.data.error = messages_get("BadType"); + + ctx->handle->cb(ctx->handle, &hlevent, ctx->handle->pw); + } + break; case LLCACHE_EVENT_ERROR: if (ctx->handle->cb != NULL) { hlcache_event hlevent; -- cgit v1.2.3