Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong «size_download» #7702

Closed
7-904-001-67-28 opened this issue Sep 11, 2021 · 12 comments
Closed

Wrong «size_download» #7702

7-904-001-67-28 opened this issue Sep 11, 2021 · 12 comments

Comments

@7-904-001-67-28
Copy link

I did this

In MS Windows Command Prompt:
curl.exe -D Header1 -I -o Header2 -w %{JSON} https://curl.se/windows/dl-7.78.0_6/curl-7.78.0_6-win64-mingw.zip
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 5719k 0 0 0 0 0 0 --:--:-- 0:00:02 --:--:-- 0
{"content_type":"application/zip","errormsg":null,"exitcode":0,"filename_effective":"Header2","ftp_entry_path":null,"http_code":200,"http_connect":0,"http_version":"2","local_ip":"10.22.0.61","local_port":9526,"method":"HEAD","num_connects":1,"num_headers":19,"num_redirects":0,"proxy_ssl_verify_result":0,"redirect_url":null,"referer":null,"remote_ip":"151.101.194.49","remote_port":443,"response_code":200,"scheme":"HTTPS","size_download":0,"size_header":769,"size_request":119,"size_upload":0,"speed_download":0,"speed_upload":0,"ssl_verify_result":0,"time_appconnect":2.281595,"time_connect":0.278050,"time_namelookup":0.070712,"time_pretransfer":2.282247,"time_redirect":0.000000,"time_starttransfer":2.616433,"time_total":2.620566,"url":"https://curl.se/windows/dl-7.78.0_6/curl-7.78.0_6-win64-mingw.zip","url_effective":"https://curl.se/windows/dl-7.78.0_6/curl-7.78.0_6-win64-mingw.zip","urlnum":0,"curl_version":"libcurl/7.78.0 OpenSSL/3.0.0 (Schannel) zlib/1.2.11 brotli/1.0.9 zstd/1.5.0 libidn2/2.3.2 libssh2/1.10.0 nghttp2/1.44.0 libgsasl/1.10.0"}

«"size_download":0»? Really? Look in the folder:
Dir Header*
Том в устройстве E имеет метку …
Серийный номер тома: …-…

Содержимое папки …:\…\cURL\curl-7.78.0_6-win64-mingw\bin

11.09.2021 07:50 769 Header1
11.09.2021 07:50 769 Header2
2 файлов 1 538 байт
0 папок … байт свободно

FC /B Header1 Header2
Сравнение файлов Header1 и HEADER2
FC: различия не найдены

Type Header2
HTTP/2 200
server: nginx/1.17.6
content-type: application/zip
x-frame-options: SAMEORIGIN
last-modified: Wed, 21 Jul 2021 04:46:56 GMT
etag: "595c91-5c79adc273000"
cache-control: max-age=31536000
expires: Fri, 09 Sep 2022 03:27:52 GMT
x-content-type-options: nosniff
content-security-policy: default-src 'self' curl.haxx.se www.curl.se curl.se www.fastly-insights.com fastly-insights.com; style-src 'unsafe-inline' 'self' curl.haxx.se www.curl.se curl.se
strict-transport-security: max-age=31536000
via: 1.1 varnish, 1.1 varnish
accept-ranges: bytes
age: 177768
date: Sat, 11 Sep 2021 04:50:40 GMT
x-served-by: cache-bma1641-BMA, cache-pdk17851-PDK
x-cache: HIT, HIT
x-cache-hits: 0, 0
x-timer: S1631335840.122262,VS0,VE1
content-length: 5856401

I expected the following

"size_download":769
Or fix the BUG №7691 («Header and JSON-report are combined.»).

curl/libcurl version

Build: 7.78.0_6
[curl -V output]
curl 7.78.0 (x86_64-pc-win32) libcurl/7.78.0 OpenSSL/3.0.0 (Schannel) zlib/1.2.11 brotli/1.0.9 zstd/1.5.0 libidn2/2.3.2 libssh2/1.10.0 nghttp2/1.44.0 libgsasl/1.10.0
Release-Date: 2021-07-21
Protocols: dict file ftp ftps gopher gophers http https imap imaps ldap ldaps mqtt pop3 pop3s rtsp scp sftp smb smbs smtp smtps telnet tftp
Features: alt-svc AsynchDNS brotli gsasl HSTS HTTP2 HTTPS-proxy IDN IPv6 Kerberos Largefile libz MultiSSL NTLM SPNEGO SSL SSPI TLS-SRP UnixSockets zstd

operating system

MS Windows 10-21H1

@dfandrich
Copy link
Contributor

dfandrich commented Sep 11, 2021 via email

@7-904-001-67-28
Copy link
Author

7-904-001-67-28 commented Sep 11, 2021

the server doesn't provide a body

curl.exe -D Header.txt -I -w %{JSON} https://curl.se/windows/dl-7.78.0_6/curl-7.78.0_6-win64-mingw.zip

If there is no body, what is the trash in the console? Double morality? Fix the BUG №7691, if there is no body.

@7-904-001-67-28
Copy link
Author

7-904-001-67-28 commented Sep 11, 2021

Two citations from Manual of cURL:
«If not told otherwise, curl writes the received data to stdout. It can be instructed to instead save that data into a local file, using the -o, --output or -O, --remote-name options.»
«Write the received protocol headers to the specified file. If no headers are received, the use of this option will create an empty file.»

Option «-o»/«--output» saves the BODY of server's answer. If no BODYS are received, the use of this option MUST create an empty file. And do not output to screen the nonexistent BODY. The size of the really saved file is 769 byte, NOT zero. Who wrote your documentation? Martians? Or china hackers?

@dfandrich
Copy link
Contributor

dfandrich commented Sep 11, 2021 via email

@dfandrich
Copy link
Contributor

dfandrich commented Sep 11, 2021 via email

@7-904-001-67-28
Copy link
Author

7-904-001-67-28 commented Sep 11, 2021

plonk

The exception over the exception. The documentation is terrible. You are not ashamed?

@jay
Copy link
Member

jay commented Sep 11, 2021

You probably want size_header not size_download. That said we could improve size_download to say it's for the body/payload. size_download maps to CURLINFO_SIZE_DOWNLOAD_T, which mentions that headers/meta are excluded.

@7-904-001-67-28
Copy link
Author

You probably want size_header not size_download.

I want to write the script with minimal count of exceptions. Yes, I can look the method=Get/Head in JSON-report and add the «If»-operator. If you can not write neither programs nor manuals.

Sorry, I do not understand what is «CURLINFO_SIZE_DOWNLOAD_T». Really. I know programing languages of high level only.

bagder added a commit that referenced this issue Sep 11, 2021
They show the number of "body" bytes transfered.
Fixes #7702
@bagder
Copy link
Member

bagder commented Sep 11, 2021

The documentation is terrible. You are not ashamed?

@7-904-001-67-28 again, if you can't be polite we will just stop listening to you. If you can't be nice, don't say anything. We've spent YEARS of efforts and sweat on this FOR FREE. What have you done to help us?

@bagder
Copy link
Member

bagder commented Sep 11, 2021

@7-904-001-67-28 a slightly more productive angle would be if you could look at #7706 and say what you think of the improvement or what else we can do to clarify this detail in the docs.

@7-904-001-67-28
Copy link
Author

7-904-001-67-28 commented Sep 11, 2021

if you could look at #7706

I have already looked, but it is too hard for me. I do not understand program development technology through the «github». My programming experience is limited to other technologies. Great sorry.
I just do not know where to look. I looked at the tabs «Conversations», «Commits», «Checks» and «Files changed». Great sorry again. Really.

Only now has appeared a panel with results of selected test (https://github.com/curl/curl/pull/7706/checks?check_run_id=3576577918). Slow Internet access may be to blame. But I do not understand anything yet.

@7-904-001-67-28
Copy link
Author

What have you done to help us?

I found some bugs that were confirmed and corrected. Is it not so?☺

@bagder bagder closed this as completed in dbe693e Sep 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging a pull request may close this issue.

4 participants