Description
Steps to reproduce
curl -G --data x /
Expected results
No output, or curl: (3) URL using bad/illegal format or missing URL
.
Actual results
curl: (27) Out of memory
Additional information
The actual command is closer to curl -Gso /dev/null -w '%{url_effective}' --data-urlencode 'foo=bar?' /path
, which in previous curl versions returned /path?foo=bar%3F
but now returns curl: (27) Out of memory
. This usage is arguably dubious to begin with, but if it is not supported, I think the error message shouldn't be "Out of memory".
curl/libcurl version
curl 7.86.0 (x86_64-pc-linux-gnu) libcurl/7.86.0 OpenSSL/3.0.7 zlib/1.2.13 brotli/1.0.9 zstd/1.5.2 libidn2/2.3.4 libpsl/0.21.1 (+libidn2/2.3.4) libssh2/1.10.0 nghttp2/1.50.0
Release-Date: 2022-10-26
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
Arch Linux
Activity
[-]curl -G --data-urlencode x / returns curl: (27) Out of memory[/-][+]curl -G --data x / returns curl: (27) Out of memory[/+]tool_operate: provide better errmsg for -G with bad URL
Hello71 commentedon Nov 12, 2022
Hm... as I understand, in new curl versions, https://stackoverflow.com/questions/296536/how-to-urlencode-data-for-curl-command/10797966 won't work anymore. Is there a better way to URL-encode some query string parameters and also send request body?
bagder commentedon Nov 12, 2022
I don't understand what you say won't work anymore. We don't break behavior. Also, not really related to this bug.
Hello71 commentedon Nov 12, 2022
sorry, I meant to link to https://stackoverflow.com/questions/296536/how-to-urlencode-data-for-curl-command/10797966#10797966. example:
bagder commentedon Nov 13, 2022
My points remain the same. Why wouldn't that work?
Hello71 commentedon Nov 16, 2022
before b82eb72,
date | src/curl -Gso /dev/null -w %{url_effective} --data-urlencode @- "" | cut -c 3-
returns the current date with url encoding. after, it returns nothing.bagder commentedon Nov 16, 2022
""
is not a valid URL. If you remove the-s
you'll see the error message.