summaryrefslogtreecommitdiff
path: root/content
diff options
context:
space:
mode:
authorJohn Mark Bell <jmb@netsurf-browser.org>2011-09-08 08:26:16 +0000
committerJohn Mark Bell <jmb@netsurf-browser.org>2011-09-08 08:26:16 +0000
commitf6ac059a05b65bd9e93ba59fd932e3f8568a250a (patch)
treea9dc0c4b26761a9701f558a08a918155adfbe2b9 /content
parentc25d7890e7b2fc87cce8804851587db805485358 (diff)
downloadnetsurf-f6ac059a05b65bd9e93ba59fd932e3f8568a250a.tar.gz
Handle zero-length documents correctly
svn path=/trunk/netsurf/; revision=12778
Diffstat (limited to 'content')
-rw-r--r--content/hlcache.c21
-rw-r--r--content/llcache.c18
2 files changed, 37 insertions, 2 deletions
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;
diff --git a/content/llcache.c b/content/llcache.c
index b02d0135f..3862cb467 100644
--- a/content/llcache.c
+++ b/content/llcache.c
@@ -1445,6 +1445,15 @@ nserror llcache_object_notify_users(llcache_object *object)
return error;
continue;
+ } else if (error == NSERROR_NEED_DATA) {
+ /* User requested replay */
+ handle->state = LLCACHE_FETCH_HEADERS;
+
+ /* Continue with the next user -- we'll
+ * reemit the event next time round */
+ user->iterator_target = false;
+ next_user = user->next;
+ continue;
} else if (error != NSERROR_OK) {
user->iterator_target = false;
return error;
@@ -1522,6 +1531,15 @@ nserror llcache_object_notify_users(llcache_object *object)
return error;
continue;
+ } else if (error == NSERROR_NEED_DATA) {
+ /* User requested replay */
+ handle->state = LLCACHE_FETCH_DATA;
+
+ /* Continue with the next user -- we'll
+ * reemit the event next time round */
+ user->iterator_target = false;
+ next_user = user->next;
+ continue;
} else if (error != NSERROR_OK) {
user->iterator_target = false;
return error;