How to activate http 2 with reqwest


#1

I know that hyper is not fully ready with http2, but I heard that hyper client can opt-in to http2 if the server guarantees to be capable of http2. I use reqwest library and my external server supports HTTP2 over plain TCP and secure TCP as well as negotiation of a protocol. Is there any way to opt-in to http2 in my client code, which uses reqwest?

PS: ping @seanmonstar


#2

No, not yet. There’s an experimental pull request on the hyper repo, but nothing released.


#3

Thanks. Hmm… are there plans to progress it?

As a workaround, is it worth using multiple reqwest clients in round robin fashion to avoid blocking requests?


#4

Hi @seanmonstar . Are there any news regarding this feature for reqwest?


#5

There has been a release of hyper v0.12, which includes HTTP2 support in the client.

It is a priority, but I haven’t yet had time to upgrade reqwest to hyper 0.12. The change is largely around replacing tokio_core bits with tokio, and the typed headers are missing. I’ll be chipping away at it, but anyone wanting to help certainly can!


#6

I could contribute to this ticket. I might need assistance because rust and rust libs are still new for me. @seanmonstar, would you be able to provide some guidance when I got stuck? What is the way to communicate with you? via this forum thread or via the ticket you referred to?


#7

Yea, I try to provide mentorship wherever I can! (Note, I’ll be largely unavailable the next 3 days.) I don’t expect the changes to be super easy, if unfamiliar with futures/tokio/hyper, but it also doesn’t require something hugely complex. Just a lot of small annoying pieces… everywhere :smiley:

Discussion and status in that issue is preferable, as if we ever need to find it again, it’s more likely people would search the issue tracker.


#8

OK. I will try to have a look into this next week.


#9

Have posted my tiny work on reqwest. It is probably not much useful for you. Sorry.

It turned out that the upgrade of reqwest to hyper 0.12 would not help in my case due to this issue in hyper (which I assume will be transparently propagated to reqwest).