Skip to content

curl -G --data x / returns curl: (27) Out of memory #9889

Closed
@Hello71

Description

@Hello71

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

changed the title [-]curl -G --data-urlencode x / returns curl: (27) Out of memory[/-] [+]curl -G --data x / returns curl: (27) Out of memory[/+] on Nov 11, 2022
self-assigned this
on Nov 11, 2022
added a commit that references this issue on Nov 11, 2022
da7ced1
Hello71

Hello71 commented on Nov 12, 2022

@Hello71
ContributorAuthor

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

bagder commented on Nov 12, 2022

@bagder
Member

Hm... as I understand, in new curl versions won't work anymore.

I don't understand what you say won't work anymore. We don't break behavior. Also, not really related to this bug.

Hello71

Hello71 commented on Nov 12, 2022

@Hello71
ContributorAuthor

sorry, I meant to link to https://stackoverflow.com/questions/296536/how-to-urlencode-data-for-curl-command/10797966#10797966. example:

date | curl -Gso /dev/null -w %{url_effective} --data-urlencode @- "" | cut -c 3-
bagder

bagder commented on Nov 13, 2022

@bagder
Member

My points remain the same. Why wouldn't that work?

Hello71

Hello71 commented on Nov 16, 2022

@Hello71
ContributorAuthor

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

bagder commented on Nov 16, 2022

@bagder
Member

"" is not a valid URL. If you remove the -s you'll see the error message.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

    Development

    Participants

    @bagder@Hello71

    Issue actions

      curl -G --data x / returns curl: (27) Out of memory · Issue #9889 · curl/curl