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

[curl] Moved getting estimated length to the headers part

This commit is contained in:
Witold Filipczyk 2023-07-23 14:51:25 +02:00
parent 26190a6a26
commit d4a682829a

View File

@ -315,8 +315,6 @@ http_curl_got_header(void *stream, void *buf, size_t len)
}
if (len == 2 && buffer[0] == 13 && buffer[1] == 10) {
curl_easy_getinfo(http->easy, CURLINFO_RESPONSE_CODE, &http->code);
if (!conn->cached) {
conn->cached = get_cache_entry(conn->uri);
@ -325,6 +323,8 @@ http_curl_got_header(void *stream, void *buf, size_t len)
return;
}
}
curl_easy_getinfo(http->easy, CURLINFO_RESPONSE_CODE, &http->code);
curl_easy_getinfo(http->easy, CURLINFO_CONTENT_LENGTH_DOWNLOAD_T, &conn->est_length);
mem_free_set(&conn->cached->head, memacpy(http->headers.source, http->headers.length));
mem_free_set(&conn->cached->content_type, NULL);
}
@ -347,9 +347,6 @@ http_got_data(void *stream, void *buf, size_t len)
if (add_fragment(conn->cached, conn->from, buffer, len) == 1) {
conn->tries = 0;
}
if (conn->from == 0 && conn->est_length == -1) {
curl_easy_getinfo(http->easy, CURLINFO_CONTENT_LENGTH_DOWNLOAD_T, &conn->est_length);
}
conn->from += len;
conn->received += len;
return;