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

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

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

Comments

@darnir
Copy link

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
Copy link
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
Copy link
Author

darnir commented Apr 27, 2017

That is an acceptable workaround. Thanks!

@bagder bagder changed the title Curl doesn't like --no-http2 when HTTP/2 is not compiled in The --no- prefix for non-booleans command line options is silently ignored Apr 30, 2017
bagder added a commit that referenced this issue May 1, 2017
... and instead properly respond with an error message to the user
instead of silently ignoring.

Fixes #1453
@bagder bagder closed this as completed 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.
Development

No branches or pull requests

2 participants