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

-w %header{name} prints broken string on the second request #9150

Closed
highmtworks opened this issue Jul 13, 2022 · 1 comment
Closed

-w %header{name} prints broken string on the second request #9150

highmtworks opened this issue Jul 13, 2022 · 1 comment
Assignees

Comments

@highmtworks
Copy link

@highmtworks highmtworks commented Jul 13, 2022

I did this

$ curl https://github.com/curl/curl -s -o /dev/null -w "%header{date}\n"
Wed, 13 Jul 2022 07:03:27 GMT

but,

$ curl https://github.com/curl/curl#[1-2] -s -o /dev/null -w "%header{date}\n"
Wed, 13 Jul 2022 07:03:44 GMT
%header{date

I expected the following

$ curl https://github.com/curl/curl#[1-2] -s -o /dev/null -w "%header{date}\n"
Wed, 13 Jul 2022 07:03:44 GMT
Wed, 13 Jul 2022 07:03:44 GMT

curl/libcurl version

curl 7.84.0 (x86_64-pc-cygwin) libcurl/7.84.0 OpenSSL/1.1.1q zlib/1.2.12 brotli/1.0.9 zstd/1.5.2 libidn2/2.3.2 libpsl/0.21.1 (+libidn2/2.3.2) libssh2/1.10.0 nghttp2/1.48.0
Release-Date: 2022-06-27
Protocols: dict file ftp ftps gopher gophers http https imap imaps mqtt pop3 pop3s rtsp scp sftp smb smbs smtp smtps telnet tftp
Features: alt-svc AsynchDNS brotli GSS-API HSTS HTTP2 HTTPS-proxy IDN IPv6 Kerberos Largefile libz NTLM NTLM_WB PSL SPNEGO SSL threadsafe TLS-SRP UnixSockets zstd

operating system

MSYS_NT-10.0-19044 hostname 3.3.5-341.x86_64 2022-07-04 21:33 UTC x86_64 Msys
on
Windows 10 Pro 21H2 19044.1766

@highmtworks
Copy link
Author

@highmtworks highmtworks commented Jul 13, 2022

@bagder bagder self-assigned this Jul 13, 2022
bagder added a commit that referenced this issue Jul 13, 2022
The function stores a terminating zero in the buffere for convenience, but
when on repeated calls that would cause problems. Starting now, the original
content is put back again and repeted calls work fine.

Fixes #9150
Reported-by: highmtworks on github
bagder added a commit that referenced this issue Jul 14, 2022
The function stored a terminating zero into the buffer for convenience,
but when on repeated calls that would cause problems. Starting now, the
passed in buffer is not modified.

Reported-by: highmtworks on github
Fixes #9150
Closes #9152
@bagder bagder closed this as completed in 0ef4f08 Jul 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants