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.
(cherry picked from commit 81f8ee1fa2
)
This commit is contained in:
parent
d15439edff
commit
1544b5f4b9
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
|
* the cache_entry should be busted or not. You are not likely to see
|
||||||
* an entry with this set to 1 in wild nature ;-). */
|
* an entry with this set to 1 in wild nature ;-). */
|
||||||
unsigned int gc_target:1; /* The GC touch of death */
|
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 */
|
enum cache_mode cache_mode; /* Reload condition */
|
||||||
};
|
};
|
||||||
|
@ -1577,6 +1577,7 @@ again:
|
|||||||
abort_connection(conn, S_OUT_OF_MEM);
|
abort_connection(conn, S_OUT_OF_MEM);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
conn->cached->cgi = conn->cgi;
|
||||||
mem_free_set(&conn->cached->head, head);
|
mem_free_set(&conn->cached->head, head);
|
||||||
|
|
||||||
if (!get_opt_bool("document.cache.ignore_cache_control")) {
|
if (!get_opt_bool("document.cache.ignore_cache_control")) {
|
||||||
|
@ -977,9 +977,6 @@ init_type_query(struct session *ses, struct download *download,
|
|||||||
{
|
{
|
||||||
struct type_query *type_query;
|
struct type_query *type_query;
|
||||||
|
|
||||||
assert(download && download->conn);
|
|
||||||
if_assert_failed return NULL;
|
|
||||||
|
|
||||||
/* There can be only one ... */
|
/* There can be only one ... */
|
||||||
foreach (type_query, ses->type_queries)
|
foreach (type_query, ses->type_queries)
|
||||||
if (compare_uri(type_query->uri, ses->loading_uri, 0))
|
if (compare_uri(type_query->uri, ses->loading_uri, 0))
|
||||||
@ -993,7 +990,7 @@ init_type_query(struct session *ses, struct download *download,
|
|||||||
type_query->target_frame = null_or_stracpy(ses->task.target.frame);
|
type_query->target_frame = null_or_stracpy(ses->task.target.frame);
|
||||||
|
|
||||||
type_query->cached = cached;
|
type_query->cached = cached;
|
||||||
type_query->cgi = download->conn->cgi;
|
type_query->cgi = cached->cgi;
|
||||||
object_lock(type_query->cached);
|
object_lock(type_query->cached);
|
||||||
|
|
||||||
move_download(download, &type_query->download, PRI_MAIN);
|
move_download(download, &type_query->download, PRI_MAIN);
|
||||||
|
Loading…
Reference in New Issue
Block a user