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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for custom connectors #1786

Closed

Conversation

inikulin
Copy link

@inikulin inikulin commented Mar 19, 2023

Hi @seanmonstar, sorry for the PR without a related GH issue.

I'm building some stuff with reqwest and added functionality to the library to use arbitrary transport for requests via custom connectors. It's very useful if you want to encapsulate requests created by the library in e.g. ProxyProtocol streams or even other request's CONNECT payload.

So, contributing my changes back to the library 馃槂

@seanmonstar
Copy link
Owner

Thanks! This looks like good work!

I've so far been hesitant to add something like this, because I didn't want to expose exactly what the transport types looked like. That they use AsyncRead/AsyncWrite, etc. And also because the resolver and proxy stuff are parts of the connector, and it feels like it could be confusing even as a user to know if a custom connector will or will not use the resolve and proxy config options.

@inikulin
Copy link
Author

Understandable, exposing library guts this way is indeed quite cumbersome and probably will cause problems for ongoing h3 work. Feel free to close - we OK to roll with a fork.

@seanmonstar
Copy link
Owner

I'd love to help you not need a fork, though...

Do you need complete control of the IO transport? Or are there a couple of simple options we could add to reqwest, such as ProxyProtocol support?

@inikulin
Copy link
Author

Oh, thanks, that would be great!

For context: I'm working on a testing library that allows arbitrary protocol encapsulation composition for clients. So, ProxyProtocol was just an example, it can really be anything, even some custom transport protocol. So, I would need a generic connector.

@inikulin
Copy link
Author

@seanmonstar what are the steps forward here?

@seanmonstar
Copy link
Owner

Well, I originally hoped it was something simpler like adding proxy protocol support. But for custom connectors... Whew boy, um. I think ideally not exposing the IO traits used by hyper is preferable (they'll be changed in hyper 1.0), and it would work for both HTTP/1,2 and /3.

Going in a completely different direction would be to move forward with a design of how we can crack open reqwest's layers, and make them simply tower layers that you could use to configure your own fat-client service.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants