Kong / unirest-java

Unirest in Java: Simplified, lightweight HTTP client library.
http://kong.github.io/unirest-java/
MIT License
2.6k stars 594 forks source link

HTTP/2 Support? #476

Closed suchorski closed 1 year ago

suchorski commented 1 year ago

There is a way to support HTTP 2?

ryber commented 1 year ago

The new release candidates support HTTP2, but require at least Java 11

suchorski commented 1 year ago

I'm using Java 17.

The RC13? In maven central has only RC2.

And how to use it?

Thanks!

ryber commented 1 year ago

The RC versions have been re-packaged to avoid conflicts. see https://github.com/Kong/unirest-java/blob/jv11/UPGRADE_GUIDE.md

ryber commented 1 year ago

https://mvnrepository.com/artifact/com.konghq/unirest-java-core

suchorski commented 1 year ago

Nice... will take a look

suchorski commented 1 year ago

Need to set something to use the HTTP 2? How to check if is using it? Unirest.config().getVersion() returns null

Thanks

suchorski commented 1 year ago

O figured out the endpoint I was accessing doesn't support TSLv1.3 and my SO updated and Java is using it. Using Postman I could disable the TSLv1.3 but can't do this with Unirest

ryber commented 1 year ago

You can in fact disable TLS Unirest.config().verifySsl(false)

You don't need to set or do anything for HTTP2, it just does it as part of negotiation

suchorski commented 1 year ago

I think the problem is not with SSL. My code works fine in my windows environment. When I deploy to the server I got 403 from API that I'm accessing. Using Postman on my Windows. I got 403 when I do a Post on /login with defaults, and 200 when I disable the TLS v1.3 protocol.

I tried Unirest.config().protocols("TLSv1.2") but I got 403 even on Windows and my server.

Did you see something like that to help me?

On the Postman woths with TLS 1.2 and Cipher ECDHE-ECDSA-AES128-GCM-SHA256

ryber commented 1 year ago

If the TLS fails you would not get a 403, you could get a connection failure

suchorski commented 1 year ago

Yeah, I think it was blocked by the server that I'm accessing.