Fix crash on receipt of a 304 response: it turns out that FETCH_HEADER may be called before any decision about how to process the response is made.

Move FETCH_HEADER handler to start of switch statement to reflect this.

svn path=/trunk/netsurf/; revision=10792
This commit is contained in:
John Mark Bell 2010-09-16 22:46:40 +00:00
parent a7dd752046
commit a10c4d3a7b
1 changed files with 13 additions and 12 deletions

View File

@ -1650,6 +1650,13 @@ void llcache_fetch_callback(fetch_msg msg, void *p, const void *data,
#endif
switch (msg) {
case FETCH_HEADER:
/* Received a fetch header */
object->fetch.state = LLCACHE_FETCH_HEADERS;
error = llcache_fetch_process_header(object, data, size);
break;
/* 3xx responses */
case FETCH_REDIRECT:
/* Request resulted in a redirect */
@ -1668,18 +1675,6 @@ void llcache_fetch_callback(fetch_msg msg, void *p, const void *data,
break;
/* Normal 2xx state machine */
case FETCH_HEADER:
/* Received a fetch header */
object->fetch.state = LLCACHE_FETCH_HEADERS;
/* Release candidate, if any */
if (object->candidate != NULL) {
object->candidate->candidate_count--;
object->candidate = NULL;
}
error = llcache_fetch_process_header(object, data, size);
break;
case FETCH_DATA:
/* Received some data */
if (object->fetch.state != LLCACHE_FETCH_DATA) {
@ -1704,6 +1699,12 @@ void llcache_fetch_callback(fetch_msg msg, void *p, const void *data,
/* Invalidate cache control data */
llcache_invalidate_cache_control_data(object);
}
/* Release candidate, if any */
if (object->candidate != NULL) {
object->candidate->candidate_count--;
object->candidate = NULL;
}
}
object->fetch.state = LLCACHE_FETCH_DATA;