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

Command line variable expansion fails for filename options (8.3.0) #12048

PBudmark opened this issue Oct 6, 2023 · 1 comment

Command line variable expansion fails for filename options (8.3.0) #12048

PBudmark opened this issue Oct 6, 2023 · 1 comment


Copy link

PBudmark commented Oct 6, 2023

I did this

I am using curl 8.3.0 on Windows 10 Home 64bit
My intention was to set an environment variable BASE to part of file name, like
SET BASE=231006_2200

and then use a fixed config file to retrieve JSON from some url,
where the config file uses BASE to build file names for headers, stderr and output:

# config file curl-K
--variable %BASE
--expand-dump-header "{{BASE}}_headers"
--expand-stderr "{{BASE}}_stderr"
--expand-output "{{BASE}}_output"
--url ""

curl -q --config curl-K

Warning: curl-K:3: warning: '--expand-dump-header' variable expansion failure
Warning: curl-K:4: warning: '--expand-stderr' variable expansion failure
Warning: curl-K:5: warning: '--expand-output' variable expansion failure
*   Trying
* Connected to ( port 443
* ALPN: curl offers h2,http/1.1
* TLSv1.3 (OUT), TLS handshake, Client hello (1):
< content-length: 197
        { "animal":"dog", "name":"Fido" },
        { "animal":"cat", "name":"Felix" },
        { "animal":"hamster", "name":"Lightning" }

I expected the following

Headers written into 231006_2200_headers, verbose output into 231006_2200_stderr and JSON output into 231006_2200_output,
but variable expansion is not available for these options,
as they are described as ARG_FILENAME in src/tool_getparam.c, array aliases.
The code at line 828 only allows expansion for options described as ARG_STRING, as --url and --data and others

curl/libcurl version

curl 8.3.0 (x86_64-w64-mingw32) libcurl/8.3.0 OpenSSL/3.1.2 (Schannel) zlib/1.3 brotli/1.1.0 zstd/1.5.5 WinIDN libssh2/1.11.0 nghttp2/1.56.0 ngtcp2/0.19.1 nghttp3/0.15.0
Release-Date: 2023-09-13
Protocols: dict file ftp ftps gopher gophers http https imap imaps ldap ldaps mqtt pop3 pop3s rtsp scp sftp smb smbs smtp smtps telnet tftp ws wss
Features: alt-svc AsynchDNS brotli HSTS HTTP2 HTTP3 HTTPS-proxy IDN IPv6 Kerberos Largefile libz MultiSSL NTLM SPNEGO SSL SSPI threadsafe UnixSockets zstd

operating system

From Windows Settings About:
Windows specifications
Edition Windows 10 Home
Version 22H2
Installed on ‎2020-‎11-‎02
OS build 19045.3448
Experience Windows Feature Experience Pack 1000.19044.1000.0

@bagder bagder self-assigned this Oct 7, 2023
bagder added a commit that referenced this issue Oct 7, 2023
Copy link

bagder commented Oct 7, 2023

thanks @PBudmark, that was a silly oversight in the code... Fixed in #12055

@bagder bagder closed this as completed in f2c8086 Oct 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Successfully merging a pull request may close this issue.

2 participants