diff --git a/docs/VERSIONS.md b/docs/VERSIONS.md index 799c545690..463253c46a 100644 --- a/docs/VERSIONS.md +++ b/docs/VERSIONS.md @@ -68,6 +68,7 @@ dates. The tool was called `httpget` before 2.0, `urlget` before 4.0 then `curl` since 4.0. `libcurl` and `curl` are always released in sync, using the same version numbers. +- 8.20.0: pending - 8.19.0: pending - 8.18.0: January 7, 2026 - 8.17.0: November 5, 2025 diff --git a/docs/libcurl/curl_easy_getinfo.md b/docs/libcurl/curl_easy_getinfo.md index 783d01b43a..e303af8ff7 100644 --- a/docs/libcurl/curl_easy_getinfo.md +++ b/docs/libcurl/curl_easy_getinfo.md @@ -305,6 +305,10 @@ RTSP session ID. See CURLINFO_RTSP_SESSION_ID(3) The scheme used for the connection. See CURLINFO_SCHEME(3) +## CURLINFO_SIZE_DELIVERED + +Number of bytes passed to the write callback. See CURLINFO_SIZE_DELIVERED(3) + ## CURLINFO_SIZE_DOWNLOAD (**Deprecated**) Number of bytes downloaded. See CURLINFO_SIZE_DOWNLOAD(3) diff --git a/docs/libcurl/opts/CURLINFO_SIZE_DELIVERED.md b/docs/libcurl/opts/CURLINFO_SIZE_DELIVERED.md new file mode 100644 index 0000000000..df7ffef62b --- /dev/null +++ b/docs/libcurl/opts/CURLINFO_SIZE_DELIVERED.md @@ -0,0 +1,78 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLINFO_SIZE_DELIVERED +Section: 3 +Source: libcurl +See-also: + - CURLINFO_SIZE_DOWNLOAD_T (3) + - CURLINFO_CONTENT_LENGTH_DOWNLOAD_T (3) + - CURLOPT_MAXFILESIZE (3) + - curl_easy_getinfo (3) + - curl_easy_setopt (3) +Protocol: + - All +Added-in: 8.20.0 +--- + +# NAME + +CURLINFO_SIZE_DELIVERED - number of delivered bytes + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_SIZE_DELIVERED, + curl_off_t *dlp); +~~~ + +# DESCRIPTION + +Pass a pointer to a *curl_off_t* to receive the total amount of bytes that +were passed on to the write callback in the download. The amount is only for +the latest transfer and gets reset again for each new transfer. This counts +actual payload data, what's also commonly called body. All meta and header +data is excluded from this amount. + +The delivered size may differ from the size retrieved with +CURLINFO_SIZE_DOWNLOAD_T(3) when CURLOPT_ACCEPT_ENCODING(3) is used for +automatic data decompression, as this is then the size of the uncompressed +body while CURLINFO_SIZE_DOWNLOAD_T(3) returns the size of the download. + +# %PROTOCOLS% + +# EXAMPLE + +~~~c +int main(void) +{ + CURL *curl = curl_easy_init(); + if(curl) { + CURLcode result; + curl_easy_setopt(curl, CURLOPT_URL, "https://example.com"); + + /* Perform the request */ + result = curl_easy_perform(curl); + + if(result == CURLE_OK) { + /* check the size */ + curl_off_t dl; + result = curl_easy_getinfo(curl, CURLINFO_SIZE_DELIVERED, &dl); + if(result == CURLE_OK) { + printf("Stored %" CURL_FORMAT_CURL_OFF_T " bytes\n", dl); + } + } + } +} +~~~ + +# %AVAILABILITY% + +# RETURN VALUE + +curl_easy_setopt(3) returns a CURLcode indicating success or error. + +CURLE_OK (0) means everything was OK, non-zero means an error occurred, see +libcurl-errors(3). diff --git a/docs/libcurl/opts/Makefile.inc b/docs/libcurl/opts/Makefile.inc index 39192b6392..e875ff3ff4 100644 --- a/docs/libcurl/opts/Makefile.inc +++ b/docs/libcurl/opts/Makefile.inc @@ -83,6 +83,7 @@ man_MANS = \ CURLINFO_RTSP_SERVER_CSEQ.3 \ CURLINFO_RTSP_SESSION_ID.3 \ CURLINFO_SCHEME.3 \ + CURLINFO_SIZE_DELIVERED.3 \ CURLINFO_SIZE_DOWNLOAD.3 \ CURLINFO_SIZE_DOWNLOAD_T.3 \ CURLINFO_SIZE_UPLOAD.3 \ diff --git a/docs/libcurl/symbols-in-versions b/docs/libcurl/symbols-in-versions index d88d45504a..08791bb82c 100644 --- a/docs/libcurl/symbols-in-versions +++ b/docs/libcurl/symbols-in-versions @@ -492,6 +492,7 @@ CURLINFO_RTSP_CSEQ_RECV 7.20.0 CURLINFO_RTSP_SERVER_CSEQ 7.20.0 CURLINFO_RTSP_SESSION_ID 7.20.0 CURLINFO_SCHEME 7.52.0 +CURLINFO_SIZE_DELIVERED 8.20.0 CURLINFO_SIZE_DOWNLOAD 7.4.1 7.55.0 CURLINFO_SIZE_DOWNLOAD_T 7.55.0 CURLINFO_SIZE_UPLOAD 7.4.1 7.55.0 diff --git a/include/curl/curl.h b/include/curl/curl.h index 632333d799..f2ce7b7a4e 100644 --- a/include/curl/curl.h +++ b/include/curl/curl.h @@ -2991,7 +2991,8 @@ typedef enum { CURLINFO_EARLYDATA_SENT_T = CURLINFO_OFF_T + 68, CURLINFO_HTTPAUTH_USED = CURLINFO_LONG + 69, CURLINFO_PROXYAUTH_USED = CURLINFO_LONG + 70, - CURLINFO_LASTONE = 70 + CURLINFO_SIZE_DELIVERED = CURLINFO_OFF_T + 71, + CURLINFO_LASTONE = 71 } CURLINFO; /* CURLINFO_RESPONSE_CODE is the new name for the option previously known as diff --git a/lib/getinfo.c b/lib/getinfo.c index dedafd382e..fbb0f6aa75 100644 --- a/lib/getinfo.c +++ b/lib/getinfo.c @@ -414,6 +414,9 @@ static CURLcode getinfo_offt(struct Curl_easy *data, CURLINFO info, case CURLINFO_FILETIME_T: *param_offt = (curl_off_t)data->info.filetime; break; + case CURLINFO_SIZE_DELIVERED: + *param_offt = data->progress.deliver; + break; case CURLINFO_SIZE_UPLOAD_T: *param_offt = data->progress.ul.cur_size; break;