1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-12-04 14:46:47 -05:00

[curl] Do not check conn->cached twice if not NULL

This commit is contained in:
Witold Filipczyk 2023-07-22 20:37:27 +02:00
parent a89738d9fb
commit d10f1c29f9
2 changed files with 18 additions and 9 deletions

View File

@ -493,11 +493,14 @@ ftpes_got_data(void *stream, void *buf, size_t len)
/* XXX: This probably belongs rather to connect.c ? */ /* XXX: This probably belongs rather to connect.c ? */
set_connection_timeout(conn); set_connection_timeout(conn);
if (!conn->cached) conn->cached = get_cache_entry(conn->uri);
if (!conn->cached) { if (!conn->cached) {
conn->cached = get_cache_entry(conn->uri);
if (!conn->cached) {
out_of_mem: out_of_mem:
abort_connection(conn, connection_state(S_OUT_OF_MEM)); abort_connection(conn, connection_state(S_OUT_OF_MEM));
return; return;
}
} }
if (len < 0) { if (len < 0) {

View File

@ -305,10 +305,13 @@ http_curl_got_header(void *stream, void *buf, size_t len)
char *buffer = (char *)buf; char *buffer = (char *)buf;
struct http_curl_connection_info *http = (struct http_curl_connection_info *)conn->info; struct http_curl_connection_info *http = (struct http_curl_connection_info *)conn->info;
if (!conn->cached) conn->cached = get_cache_entry(conn->uri);
if (!conn->cached) { if (!conn->cached) {
abort_connection(conn, connection_state(S_OUT_OF_MEM)); conn->cached = get_cache_entry(conn->uri);
return;
if (!conn->cached) {
abort_connection(conn, connection_state(S_OUT_OF_MEM));
return;
}
} }
if (len < 0) { if (len < 0) {
@ -333,10 +336,13 @@ http_got_data(void *stream, void *buf, size_t len)
char *buffer = (char *)buf; char *buffer = (char *)buf;
struct http_curl_connection_info *http = (struct http_curl_connection_info *)conn->info; struct http_curl_connection_info *http = (struct http_curl_connection_info *)conn->info;
if (!conn->cached) conn->cached = get_cache_entry(conn->uri);
if (!conn->cached) { if (!conn->cached) {
abort_connection(conn, connection_state(S_OUT_OF_MEM)); conn->cached = get_cache_entry(conn->uri);
return;
if (!conn->cached) {
abort_connection(conn, connection_state(S_OUT_OF_MEM));
return;
}
} }
if (len < 0) { if (len < 0) {