-
Notifications
You must be signed in to change notification settings - Fork 4
Add proxy for http client #191
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
Conversation
Pull Request Test Coverage Report for Build 796Details
💛 - Coveralls |
| // let (response, body) = @http.get("https://www.youtube.com", proxy~) | ||
| // inspect(response.code, content="200") | ||
| // assert_true(body.text().contains("YouTube")) | ||
| // } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
testing can be done by:
- set up a local TCP server
- use
@http.ServerConnection::newto wrap a TCP connection and handle theCONNECTrequest - discard the
@http.ServerConnectionand inspect the underlying TCP connection for tunneled traffic
| ForHttps(String, Int) | ||
| ForAll(String, Int) | ||
| Custom(http~ : (String, Int), https~ : (String, Int)) | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure if this abstraction is necessary. For @http.Client::connect and @http.get, the protocol is always known. So protocol based proxy selection should be done manually by the user IMO, and @http should just accept an optional (host, port) pair for proxy
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, I think we should leave some room for future HTTPS proxy support (i.e. the CONNECT request itself is TLS encrypted) in the API design
|
My idea on API design:
This way we get:
|
|
close via #199 |
Add a proxy for http client.
proxy.mbtREADME.mbt.mdproxy_test.mbt, it can be verified when developers have a proxy server