-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Add support for javax.net.ssl.HostnameVerifier to HttpClient #3154
Comments
I was looking for it. It would be really helpful if this could be added as an easy-to-use built-in feature just like Apache HttpClient. We have our own implementation of HostnameVerifier (it takes into consideration various options configured by the user) that we were using with Apache HttpClient for HTTP/1.1 support. Since the current implementation of Apache HttpClient with HTTP/2 support (version 5.0) is still in beta, we decided to go with Jetty. A simple way I would have liked to use it would have been:
|
Can I ask what is the use case here? You want to allow certain hosts that don't match the certificate and at the same time disallow other hosts that also don't match the certificate? I ask because in the expression Can you detail a case where you need both? |
Would be great if you guys can test the code with this issue fixed and report if it works fine for you. |
@sbordet thanks for working on this. My use case was that we have some properties exposed to the users of our application like whether to allow wildcard certificates or not and looking at SubjectAlternativeNames (SAN) to match hostname etc. All these global configurations are taken into account by out HostnameVerifier implementation. We were able to accomplish this by 2 ways:
Also, throwing the exception in Listener or in the
|
@sbordet Sure, will test out my use case and let you know. |
The current work on commit 8964608 calls the verifier only at the moment the connection is established. For your case, when the connection is not good for your settings, have you tried to close the connection and return |
If we return Will try this out as well and get back to you on yow was the behaviour. |
…lient. Added javadocs after review. Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
Fixes #3154 - Add support for javax.net.ssl.HostnameVerifier to HttpClient
…lient. Fixed compilation errors after merge. Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
Currently
javax.net.ssl.HostnameVerifier
is a way to perform Hostname verification within the following libraries (but not Jetty'sHttpClient
) ...Java itself
OkHttp
Apache HttpClient 3.x
Apache HttpClient 4.x
Investigate if we should offer this in Jetty's HttpClient as well.
The text was updated successfully, but these errors were encountered: