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,12 +493,15 @@ 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) {
conn->cached = get_cache_entry(conn->uri);
if (!conn->cached) { 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) {
abort_connection(conn, connection_state_for_errno(errno)); abort_connection(conn, connection_state_for_errno(errno));

View File

@ -305,11 +305,14 @@ 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) {
conn->cached = get_cache_entry(conn->uri);
if (!conn->cached) { if (!conn->cached) {
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) {
abort_connection(conn, connection_state_for_errno(errno)); abort_connection(conn, connection_state_for_errno(errno));
@ -333,11 +336,14 @@ 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) {
conn->cached = get_cache_entry(conn->uri);
if (!conn->cached) { if (!conn->cached) {
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) {
abort_connection(conn, connection_state_for_errno(errno)); abort_connection(conn, connection_state_for_errno(errno));