summaryrefslogtreecommitdiff
path: root/content
diff options
context:
space:
mode:
authorVincent Sanders <vince@kyllikki.org>2016-01-06 23:53:02 +0000
committerVincent Sanders <vince@kyllikki.org>2016-01-06 23:53:02 +0000
commitb1e0a711c798c48059c5d40835649c84e109d056 (patch)
tree208c2784263718739871b2f9c4ff73ff84cc7789 /content
parent51de6c2e7cad5940a8f84cd218ce837da3561790 (diff)
downloadnetsurf-b1e0a711c798c48059c5d40835649c84e109d056.tar.gz
netsurf-b1e0a711c798c48059c5d40835649c84e109d056.tar.bz2
Stop reporting error from mime sniffing when a fetcher completes with no data
If a fetcher returns with no data (no content or http error code 204) the hlcache state machine was trying to mimesniff using non existent header data and reporting the resulting NSERROR_NOT_FOUND as a "BadType" message. This changes the behaviour to be similar to that in the headers received case where NSERROR_NOT_FOUND from the mimesniffing is not an error.
Diffstat (limited to 'content')
-rw-r--r--content/hlcache.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/content/hlcache.c b/content/hlcache.c
index 85567f5a4..3f0e810a5 100644
--- a/content/hlcache.c
+++ b/content/hlcache.c
@@ -464,10 +464,12 @@ static nserror hlcache_llcache_callback(llcache_handle *handle,
*/
error = mimesniff_compute_effective_type(handle,
NULL, 0, false, false, &effective_type);
- if (error == NSERROR_OK) {
+ if (error == NSERROR_OK || error == NSERROR_NOT_FOUND) {
error = hlcache_migrate_ctx(ctx, effective_type);
- lwc_string_unref(effective_type);
+ if (effective_type != NULL) {
+ lwc_string_unref(effective_type);
+ }
return error;
}
@@ -475,8 +477,8 @@ static nserror hlcache_llcache_callback(llcache_handle *handle,
if (ctx->handle->cb != NULL) {
hlcache_event hlevent;
- hlevent.type = CONTENT_MSG_ERROR;
- hlevent.data.error = messages_get("BadType");
+ hlevent.type = CONTENT_MSG_ERRORCODE;
+ hlevent.data.errorcode = error;
ctx->handle->cb(ctx->handle, &hlevent, ctx->handle->pw);
}