mirror of
https://github.com/curl/curl.git
synced 2026-04-14 22:41:40 +03:00
Compare commits
7 commits
da0597d07d
...
84333580d4
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
84333580d4 | ||
|
|
54c1106507 | ||
|
|
87eae5ec2d | ||
|
|
e289dc733e | ||
|
|
a70f289dfa | ||
|
|
af9417ddfc | ||
|
|
69c6cda944 |
13 changed files with 103 additions and 4 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -193,6 +193,10 @@ known as "http_code"). (Added in 7.18.2)
|
|||
## `scheme`
|
||||
The URL scheme (sometimes called protocol) that was effectively used. (Added in 7.52.0)
|
||||
|
||||
## `size_delivered`
|
||||
The total amount of data that were saved or written to stdout. When
|
||||
--compressed is used, this is likely different than `size_download`.
|
||||
|
||||
## `size_download`
|
||||
The total amount of bytes that were downloaded. This is the size of the
|
||||
body/data that was transferred, excluding headers.
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
78
docs/libcurl/opts/CURLINFO_SIZE_DELIVERED.md
Normal file
78
docs/libcurl/opts/CURLINFO_SIZE_DELIVERED.md
Normal file
|
|
@ -0,0 +1,78 @@
|
|||
---
|
||||
c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, 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 <curl/curl.h>
|
||||
|
||||
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).
|
||||
|
|
@ -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 \
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -461,6 +461,8 @@ static const struct writeoutvar variables[] = {
|
|||
{ "remote_port", VAR_PRIMARY_PORT, CURLINFO_PRIMARY_PORT, writeLong },
|
||||
{ "response_code", VAR_HTTP_CODE, CURLINFO_RESPONSE_CODE, writeLong },
|
||||
{ "scheme", VAR_SCHEME, CURLINFO_SCHEME, writeString },
|
||||
{ "size_delivered", VAR_SIZE_DELIVERED, CURLINFO_SIZE_DELIVERED,
|
||||
writeOffset },
|
||||
{ "size_download", VAR_SIZE_DOWNLOAD, CURLINFO_SIZE_DOWNLOAD_T,
|
||||
writeOffset },
|
||||
{ "size_header", VAR_HEADER_SIZE, CURLINFO_HEADER_SIZE, writeLong },
|
||||
|
|
|
|||
|
|
@ -90,6 +90,7 @@ typedef enum {
|
|||
VAR_REFERER,
|
||||
VAR_REQUEST_SIZE,
|
||||
VAR_SCHEME,
|
||||
VAR_SIZE_DELIVERED,
|
||||
VAR_SIZE_DOWNLOAD,
|
||||
VAR_SIZE_UPLOAD,
|
||||
VAR_SPEED_DOWNLOAD,
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ http
|
|||
HTTP GET gzip compressed content
|
||||
</name>
|
||||
<command>
|
||||
http://%HOSTIP:%HTTPPORT/%TESTNUMBER --compressed
|
||||
http://%HOSTIP:%HTTPPORT/%TESTNUMBER --compressed -s -w '%{stderr}%{size_delivered}\n'
|
||||
</command>
|
||||
</client>
|
||||
|
||||
|
|
@ -67,5 +67,8 @@ Accept: */*
|
|||
Accept-Encoding: xxx
|
||||
|
||||
</protocol>
|
||||
<stderr>
|
||||
24
|
||||
</stderr>
|
||||
</verify>
|
||||
</testcase>
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ Accept: */*
|
|||
|
||||
</protocol>
|
||||
<stdout nonewline="yes">
|
||||
{"certs":"","conn_id":0,"content_type":"text/html","errormsg":null,"exitcode":0,"filename_effective":"%LOGDIR/out%TESTNUMBER","ftp_entry_path":null,"http_code":200,"http_connect":0,"http_version":"1.1","local_ip":"127.0.0.1","local_port":13,"method":"GET","num_certs":0,"num_connects":1,"num_headers":9,"num_redirects":0,"num_retries":0,"proxy_ssl_verify_result":0,"proxy_used":0,"redirect_url":null,"referer":null,"remote_ip":"%HOSTIP","remote_port":%HTTPPORT,"response_code":200,"scheme":"http","size_download":445,"size_header":4019,"size_request":4019,"size_upload":0,"speed_download":13,"speed_upload":13,"ssl_verify_result":0,"time_appconnect":0.000013,"time_connect":0.000013,"time_namelookup":0.000013,"time_posttransfer":0.000013,"time_pretransfer":0.000013,"time_queue":0.000013,"time_redirect":0.000013,"time_starttransfer":0.000013,"time_total":0.000013,"tls_earlydata":0,"url":"http://%HOSTIP:%HTTPPORT/%TESTNUMBER","url.fragment":null,"url.host":"127.0.0.1","url.options":null,"url.password":null,"url.path":"/%TESTNUMBER","url.port":"%HTTPPORT","url.query":null,"url.scheme":"http","url.user":null,"url.zoneid":null,"url_effective":"http://%HOSTIP:%HTTPPORT/%TESTNUMBER","urle.fragment":null,"urle.host":"127.0.0.1","urle.options":null,"urle.password":null,"urle.path":"/%TESTNUMBER","urle.port":"%HTTPPORT","urle.query":null,"urle.scheme":"http","urle.user":null,"urle.zoneid":null,"urlnum":0,"xfer_id":0,"curl_version":"curl-unit-test-fake-version"}
|
||||
{"certs":"","conn_id":0,"content_type":"text/html","errormsg":null,"exitcode":0,"filename_effective":"%LOGDIR/out%TESTNUMBER","ftp_entry_path":null,"http_code":200,"http_connect":0,"http_version":"1.1","local_ip":"127.0.0.1","local_port":13,"method":"GET","num_certs":0,"num_connects":1,"num_headers":9,"num_redirects":0,"num_retries":0,"proxy_ssl_verify_result":0,"proxy_used":0,"redirect_url":null,"referer":null,"remote_ip":"%HOSTIP","remote_port":%HTTPPORT,"response_code":200,"scheme":"http","size_delivered":445,"size_download":445,"size_header":4019,"size_request":4019,"size_upload":0,"speed_download":13,"speed_upload":13,"ssl_verify_result":0,"time_appconnect":0.000013,"time_connect":0.000013,"time_namelookup":0.000013,"time_posttransfer":0.000013,"time_pretransfer":0.000013,"time_queue":0.000013,"time_redirect":0.000013,"time_starttransfer":0.000013,"time_total":0.000013,"tls_earlydata":0,"url":"http://%HOSTIP:%HTTPPORT/%TESTNUMBER","url.fragment":null,"url.host":"127.0.0.1","url.options":null,"url.password":null,"url.path":"/%TESTNUMBER","url.port":"%HTTPPORT","url.query":null,"url.scheme":"http","url.user":null,"url.zoneid":null,"url_effective":"http://%HOSTIP:%HTTPPORT/%TESTNUMBER","urle.fragment":null,"urle.host":"127.0.0.1","urle.options":null,"urle.password":null,"urle.path":"/%TESTNUMBER","urle.port":"%HTTPPORT","urle.query":null,"urle.scheme":"http","urle.user":null,"urle.zoneid":null,"urlnum":0,"xfer_id":0,"curl_version":"curl-unit-test-fake-version"}
|
||||
</stdout>
|
||||
</verify>
|
||||
</testcase>
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ Accept: */*
|
|||
|
||||
</protocol>
|
||||
<stdout mode="text">
|
||||
{"certs":"","conn_id":0,"content_type":"text/html","errormsg":null,"exitcode":0,"filename_effective":"%LOGDIR/out%TESTNUMBER","ftp_entry_path":null,"http_code":200,"http_connect":0,"http_version":"1.1","local_ip":"127.0.0.1","local_port":13,"method":"GET","num_certs":0,"num_connects":1,"num_headers":9,"num_redirects":0,"num_retries":0,"proxy_ssl_verify_result":0,"proxy_used":0,"redirect_url":null,"referer":null,"remote_ip":"%HOSTIP","remote_port":%HTTPPORT,"response_code":200,"scheme":"http","size_download":445,"size_header":4019,"size_request":4019,"size_upload":0,"speed_download":13,"speed_upload":13,"ssl_verify_result":0,"time_appconnect":0.000013,"time_connect":0.000013,"time_namelookup":0.000013,"time_posttransfer":0.000013,"time_pretransfer":0.000013,"time_queue":0.000013,"time_redirect":0.000013,"time_starttransfer":0.000013,"time_total":0.000013,"tls_earlydata":0,"url":"http://%HOSTIP:%HTTPPORT/%TESTNUMBER","url.fragment":null,"url.host":"127.0.0.1","url.options":null,"url.password":null,"url.path":"/%TESTNUMBER","url.port":"%HTTPPORT","url.query":null,"url.scheme":"http","url.user":null,"url.zoneid":null,"url_effective":"http://%HOSTIP:%HTTPPORT/%TESTNUMBER","urle.fragment":null,"urle.host":"127.0.0.1","urle.options":null,"urle.password":null,"urle.path":"/%TESTNUMBER","urle.port":"%HTTPPORT","urle.query":null,"urle.scheme":"http","urle.user":null,"urle.zoneid":null,"urlnum":0,"xfer_id":0,"curl_version":"curl-unit-test-fake-version"}
|
||||
{"certs":"","conn_id":0,"content_type":"text/html","errormsg":null,"exitcode":0,"filename_effective":"%LOGDIR/out%TESTNUMBER","ftp_entry_path":null,"http_code":200,"http_connect":0,"http_version":"1.1","local_ip":"127.0.0.1","local_port":13,"method":"GET","num_certs":0,"num_connects":1,"num_headers":9,"num_redirects":0,"num_retries":0,"proxy_ssl_verify_result":0,"proxy_used":0,"redirect_url":null,"referer":null,"remote_ip":"%HOSTIP","remote_port":%HTTPPORT,"response_code":200,"scheme":"http","size_delivered":445,"size_download":445,"size_header":4019,"size_request":4019,"size_upload":0,"speed_download":13,"speed_upload":13,"ssl_verify_result":0,"time_appconnect":0.000013,"time_connect":0.000013,"time_namelookup":0.000013,"time_posttransfer":0.000013,"time_pretransfer":0.000013,"time_queue":0.000013,"time_redirect":0.000013,"time_starttransfer":0.000013,"time_total":0.000013,"tls_earlydata":0,"url":"http://%HOSTIP:%HTTPPORT/%TESTNUMBER","url.fragment":null,"url.host":"127.0.0.1","url.options":null,"url.password":null,"url.path":"/%TESTNUMBER","url.port":"%HTTPPORT","url.query":null,"url.scheme":"http","url.user":null,"url.zoneid":null,"url_effective":"http://%HOSTIP:%HTTPPORT/%TESTNUMBER","urle.fragment":null,"urle.host":"127.0.0.1","urle.options":null,"urle.password":null,"urle.path":"/%TESTNUMBER","urle.port":"%HTTPPORT","urle.query":null,"urle.scheme":"http","urle.user":null,"urle.zoneid":null,"urlnum":0,"xfer_id":0,"curl_version":"curl-unit-test-fake-version"}
|
||||
</stdout>
|
||||
</verify>
|
||||
</testcase>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue