mirror of
https://github.com/rkd77/elinks.git
synced 2024-12-04 14:46:47 -05:00
bug 991: fix crash when the file is already cached
If the user opens the same file again after it is in the cache, then ELinks does not always open a new connection, so download->conn can be NULL in init_type_query(), and download->conn->cgi would crash. Don't read that, then; instead add a new flag cache_entry.cgi, which http_got_header() sets or clears as soon as possible after the cache entry has been created.
This commit is contained in:
parent
2aa70f77bc
commit
81f8ee1fa2
1
src/cache/cache.h
vendored
1
src/cache/cache.h
vendored
@ -63,6 +63,7 @@ struct cache_entry {
|
||||
* the cache_entry should be busted or not. You are not likely to see
|
||||
* an entry with this set to 1 in wild nature ;-). */
|
||||
unsigned int gc_target:1; /* The GC touch of death */
|
||||
unsigned int cgi:1; /* Is a CGI output? */
|
||||
|
||||
enum cache_mode cache_mode; /* Reload condition */
|
||||
};
|
||||
|
@ -1587,6 +1587,7 @@ again:
|
||||
abort_connection(conn, S_OUT_OF_MEM);
|
||||
return;
|
||||
}
|
||||
conn->cached->cgi = conn->cgi;
|
||||
mem_free_set(&conn->cached->head, head);
|
||||
|
||||
if (!get_opt_bool("document.cache.ignore_cache_control", NULL)) {
|
||||
|
@ -975,9 +975,6 @@ init_type_query(struct session *ses, struct download *download,
|
||||
{
|
||||
struct type_query *type_query;
|
||||
|
||||
assert(download && download->conn);
|
||||
if_assert_failed return NULL;
|
||||
|
||||
/* There can be only one ... */
|
||||
foreach (type_query, ses->type_queries)
|
||||
if (compare_uri(type_query->uri, ses->loading_uri, 0))
|
||||
@ -991,7 +988,7 @@ init_type_query(struct session *ses, struct download *download,
|
||||
type_query->target_frame = null_or_stracpy(ses->task.target.frame);
|
||||
|
||||
type_query->cached = cached;
|
||||
type_query->cgi = download->conn->cgi;
|
||||
type_query->cgi = cached->cgi;
|
||||
object_lock(type_query->cached);
|
||||
|
||||
move_download(download, &type_query->download, PRI_MAIN);
|
||||
|
Loading…
Reference in New Issue
Block a user