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

How to use proxy with dio_http2_adapter #1259

Closed
longphanmn opened this issue Aug 27, 2021 · 3 comments
Closed

How to use proxy with dio_http2_adapter #1259

longphanmn opened this issue Aug 27, 2021 · 3 comments

Comments

@longphanmn
Copy link

I can set proxy with default httpClientAdapter.
But with dio_http2_adapter, cannot set proxy.
Anyone know how to set proxy with dio_http2_adapter?

@swoderheart
Copy link

the same question for me. Anyone know?

@m369848622
Copy link

you can use charles + postern to catch http2, may be need to trust charles certificate on your phone

@Neronse
Copy link

Neronse commented Jun 22, 2022

I can set proxy with default httpClientAdapter. But with dio_http2_adapter, cannot set proxy. Anyone know how to set proxy with dio_http2_adapter?

No, you can't set proxy with this implementation of dio_http 2_adapter.
The reason is that dart http 1 client implement tunnel proxy out of box, http2 dont.
You can write your own implementation of Connection Manager that support tunnel connection.
Example is here: dart-lang/http#1360

To get proxy host and port you need to ask system like this in android: System.getProperty("http.proxyHost"), System.getProperty("http.proxyPort")

AlexV525 added a commit that referenced this issue Mar 28, 2023
### New Pull Request Checklist

- [X] I have read the
[Documentation](https://pub.dartlang.org/packages/dio)
- [X] I have searched for a similar pull request in the
[project](https://github.com/flutterchina/dio/pulls) and found none
- [X] I have updated this branch with the latest `develop` to avoid
conflicts (via merge from master or rebase)
- [x] I have added the required tests to prove the fix/feature I am
adding
- [X] I have updated the documentation (if necessary)
- [X] I have run the tests and they pass

This merge request fixes / refers to the following issues: #1259 #905

### Pull Request Description

Added proxy tunnel to http2 adaptor

---------

Signed-off-by: Alexey Z <[email protected]>
Signed-off-by: Alex Li <[email protected]>
Co-authored-by: Alexey Zdorovykh <[email protected]>
Co-authored-by: Alex Li <[email protected]>
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

No branches or pull requests

5 participants