Skip to content

Missing APPDATA and USERPROFILE environment variables cause error "curl: (27) Out of memory" #4644

@vovcacik

Description

@vovcacik

I did this

C:\Users\Admin\Desktop>curl.exe https://[redacted].[redacted] -i -T "C:\Users\Admin\AppData\Local\Temp\test.txt
curl: (27) Out of memory

I expected the following

C:\Users\Admin\Desktop>curl.exe https://[redacted].[redacted] -i -T "C:\Users\Admin\AppData\Local\Temp\test.txt
HTTP/2 200
content-location: /a
content-type: text/plain
server: [redacted]
content-length: 3
date: Wed, 27 Nov 2019 17:49:03 GMT

/a

curl/libcurl version

C:\Users\Admin>curl --version
curl 7.62.0 (x86_64-pc-win32) libcurl/7.62.0 OpenSSL/1.1.1 (WinSSL) zlib/1.2.11 brotli/1.0.7 WinIDN libssh2/1.8.0 nghttp2/1.34.0
Release-Date: 2018-10-31
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtsp scp sftp smb smbs smtp smtps telnet tftp
Features: AsynchDNS IDN IPv6 Largefile SSPI Kerberos SPNEGO NTLM SSL libz brotli TLS-SRP HTTP2 HTTPS-proxy MultiSSL

operating system

Windows 10

description

The problem is curl depends on USERPROFILE and APPDATA environment variables and when both are unset it quickly fails with curl: (27) Out of memory.

Points to address:

  • is curl expected to fail when the env vars are missing?
  • should it fail with out of memory error despite of this seems more like configuration/context/file access problem?
  • the error does not occur when I run curl --version or e.g. curl --help
  • issue curl error: out of memory (27) #3117 has exactly the same symptoms
  • difficult to debug as the error is misleading and afaik this dependency is not documented

The solution is

  • to set one of the variables or both to its appropriate value
  • to make sure curl is invoked with all environment variables

Feel free to close.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions