hyper
hyper copied to clipboard
Add option to HttpConnector to enable or disable HttpInfo
Is your feature request related to a problem? Please describe.
By default hyper will try to get the HttpInfo
for each Response even if they are not needed in most cases. The bottom line is that getpeername
and getsockname
are actually very slow and they can become a performance bottleneck when making a lot of requests
Describe the solution you'd like Just provide an API like client::Builder::set_host
It could be an option on HttpConnector
.
hey @seanmonstar, I would like to take this up. Please assign this to me 😄
@seanmonstar If no one is currently working on this and if this is still needed, I would like to take it up. Also, I think the relevant code is no longer part of the hyper
crate and has instead moved into hyper-util
.
I noticed your comment on the linked PR of adding the configuration without introducing a new type. However, based on the below snippet, the Connection
trait is implemented for tokio::TcpStream
which has no access to Config
where the new flag will be stored. Do you have any pointers on getting access to this flag without an outer wrapper object?
https://github.com/hyperium/hyper-util/blob/85aade41a080fc4b40a9a53c818680feed14f138/src/client/connect/http.rs#L342-L366
I think the calls to peer_addr()
and local_addr()
should be lazy-loaded, then the connection object would cache the results.