Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't create or modify hyper::client::connect::Destination #1564

Closed
kpcyrd opened this issue Jun 12, 2018 · 3 comments
Closed

Can't create or modify hyper::client::connect::Destination #1564

kpcyrd opened this issue Jun 12, 2018 · 3 comments
Labels
A-client Area: client. B-rfc Blocked: More comments would be useful in determine next steps.

Comments

@kpcyrd
Copy link

kpcyrd commented Jun 12, 2018

I'm trying to write a connector that takes a destination, modifies it and passes it to the next connector. It seems this is currently not possible because there's no way to get a mutable reference to the internal state and only hyper can create new Destination objects.

My usecase is having a custom dns resolver as a Connector that resolves the domain before passing it to the final HttpConnector that creates the connection.

@seanmonstar
Copy link
Member

I definitely get the use case! I'd like to find a way to support it, but I'd also like to list why the constructor was so far private:

  • The Destination type may gain more fields, such as in Add ALPN/HTTP2 support to Connect #1485 to support ALPN.
  • I worried that if a Destination gained more fields in new release, and a connector didn't know that and could create their own, then it could be possible for some intent on the connect action could be silently lost.

What if, without adding a constructor, you could just mutate the internal URI of the Destination?

@seanmonstar seanmonstar added A-client Area: client. B-rfc Blocked: More comments would be useful in determine next steps. labels Jun 12, 2018
@kpcyrd
Copy link
Author

kpcyrd commented Jun 12, 2018

that would work for me as well

@sfackler
Copy link
Contributor

This would be nice for me as well. In hyper 0.11, I had a "stack" of composed connectors: HttpsConnector<ProxyConnector<HttpConnector>>. The ProxyConnector handled CONNECT tunneling for HTTPS proxies, and so needs to tell the underlying connector to point to the proxy address. In 0.12, that isn't currently possible so I ended up using a non-connector type under the ProxyConnector that just took a host/port.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-client Area: client. B-rfc Blocked: More comments would be useful in determine next steps.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants