Skip to content

Is it possible to detect when an HTTP/1.1 request is being sent on an existing connection versus opening a new connection? #3139

Answered by seanmonstar
declanvk asked this question in Q&A
Discussion options

You must be logged in to vote

Assuming you are referring to v0.14.x, and the pooling hyper::Client, then: perhaps a couple things that likely will be different in 1.0.

  • If you're using tracing, you could look at the events hyper outputs. I believe it has different messages for re-using a connection versus establishing a new one. Those messages are not part of a stable API, though. As in, they could conceivably be changed in new versions to make the wording clearer, or something.
  • If using HttpConnector (or a TLS connector that wraps it), you could probably check the HttpInfo on the Response and peek at the local addr to see if the port is new. But then again, once a socket is closed and the kernel's CLOSE_WAIT time has…

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@declanvk
Comment options

@seanmonstar
Comment options

Answer selected by declanvk
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants