-
-
Notifications
You must be signed in to change notification settings - Fork 6.6k
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
Missing APPDATA and USERPROFILE environment variables cause error "curl: (27) Out of memory" #4644
Comments
homedir function looks in this order for win32 Lines 88 to 94 in 2e9b725
CURLE_OUT_OF_MEMORY could happen but only if built with ssh support: Lines 1520 to 1540 in 2e9b725
Broken (albeit inadvertently) in fb3845a which was over 9 years ago. Prior to that it didn't work right anyway without a homedir, it appears it would set it to /_ssh/known_hosts. We could fix this by moving the if(result) break; to inside the if(file) block. However there may be other places that curl expects a homedir. Do you know why those variables are not set for you? |
This "out of memory" error is in this case just a wrong error message since curl couldn't continue anyway. The reason for the wrong error message is of course that |
Maybe the homedir function should be adjusted to use SHGetFolderPath on Windows? |
I think shell32 may have some problems if run from a service (ie curl is run by a service and not a normal user account), so I'm not sure we'd want curl/libcurl to depend on it. I think it's possible to try for appdata location from the registry as a backup if env var is empty, maybe that would be better.. @captain-caveman2k opinion? |
But if we'd do that function call as a last resort when no env variable exists, shouldn't that at least cover @vovcacik's case? |
Yes it will cover his case but I'm kind of interested why his case, I've just never heard of it happening before. It seems like something exclusively for him (until proven otherwise). |
Yes, the curl is executed in cgi script.
Agreed, I was able to fix this on my end rather easily. Actually my first thought was that the environment is broken because of the cgi, but the error message indicating far more severe error state held me from digging in that first. Hence this issue.
Not in my case, but yeah...
I think it would, the cgi host was purging envvars only and not e.g. registry read permissions. Other CGI servers could though.
I am surprised myself, this should have surfaced many times before. However I am quite convinced that #3117 issue had the same culprit, same symptoms and I wouldn't be surprised if his java server or his mingw stripped the envvars. Just a speculation though. I would be quite happy with simply more descriptive error message. The |
Reported-by: Vlastimil Ovčáčík Fixes #4644
I did this
I expected the following
curl/libcurl version
operating system
Windows 10
description
The problem is curl depends on
USERPROFILE
andAPPDATA
environment variables and when both are unset it quickly fails withcurl: (27) Out of memory
.Points to address:
curl --version
or e.g.curl --help
The solution is
Feel free to close.
The text was updated successfully, but these errors were encountered: