libetl/curl

Crash if -u option passed without a password

rpocklington opened this issue · 2 comments

Describe the bug
If the following parameter string is passed in to curl, it will crash.
-u user some_url

While curler doesn't support -u without a password, curl itself does, so it's not surprising for someone to try. Either way, it should fail gracefully instead of crash.

Environment
Special configuration in /etc/hosts ? N
Reverse proxy ? N
VPN ? N
Proxy ? N

Curl command line
-u user http://google.com

Expected behavior
An error message explaining that the -u option must be in the format user:password.

Stacktrace
If applicable, add a full stacktrace including the wrapping exceptions / nested causes.

Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 1
	at org.toilelibre.libe.curl.HttpClientProvider.handleAuthMethod(HttpClientProvider.java:108)
	at org.toilelibre.libe.curl.HttpClientProvider.prepareHttpClient(HttpClientProvider.java:51)
	at org.toilelibre.libe.curl.Curl.curl(Curl.java:28)
	at bluemedora.Curler.main(Curler.java:14)

Oops sorry I did not notice the issue any earlier.

I will try to reproduce the problem tomorrow.

Thanks for the feedback.

in 0.0.20.