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

The --no- prefix for non-booleans command line options is silently ignored #1453

Closed
darnir opened this Issue Apr 27, 2017 · 2 comments

Comments

Projects
None yet
2 participants
@darnir

darnir commented Apr 27, 2017

I did this

Execute curl with the option --no-http2. E.g.:
$ curl --no-http2 example.com

I expected the following

I expect curl to continue running. However, instead curl returns an error:

curl: (1) Unsupported protocol

My version of curl is built without HTTP/2 support. However, the binary should still support the --no-http2 flag without any issues. The use case for this is usage of curl in a script where one wants to avoid a HTTP/2 connection. Such a script ends up failing on systems where curl is built without HTTP/2 support anyways.

curl/libcurl version

curl 7.54.0 (x86_64-pc-linux-gnu) libcurl/7.54.0 OpenSSL/1.1.0e zlib/1.2.11 libpsl/0.17.0 (+libicu/58.2) libssh2/1.8.0
Protocols: dict file ftp ftps gopher http https imap imaps pop3 pop3s rtsp scp sftp smb smbs smtp smtps telnet tftp
Features: AsynchDNS IPv6 Largefile GSS-API Kerberos SPNEGO NTLM NTLM_WB SSL libz TLS-SRP UnixSockets HTTPS-proxy PSL

operating system

Arch Linux

@bagder

This comment has been minimized.

Show comment
Hide comment
@bagder

bagder Apr 27, 2017

Member

I can see how you want this, but this option is actually not a boolean so there is no "opposite". To get what you want, you can use the - - http1.1 option instead.

We should still improve the parser/error message for this use...

Member

bagder commented Apr 27, 2017

I can see how you want this, but this option is actually not a boolean so there is no "opposite". To get what you want, you can use the - - http1.1 option instead.

We should still improve the parser/error message for this use...

@darnir

This comment has been minimized.

Show comment
Hide comment
@darnir

darnir Apr 27, 2017

That is an acceptable workaround. Thanks!

darnir commented Apr 27, 2017

That is an acceptable workaround. Thanks!

@bagder bagder changed the title from Curl doesn't like --no-http2 when HTTP/2 is not compiled in to The --no- prefix for non-booleans command line options is silently ignored Apr 30, 2017

@bagder bagder added the cmdline tool label Apr 30, 2017

bagder added a commit that referenced this issue May 1, 2017

curl: non-boolean command line args reject --no- prefixes
... and instead properly respond with an error message to the user
instead of silently ignoring.

Fixes #1453

@bagder bagder closed this in 913c3c8 May 2, 2017

@lock lock bot locked as resolved and limited conversation to collaborators May 6, 2018

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