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

AndroidClientHandler doesn't support proxy servers #2123

Closed
dominik-weber opened this issue Aug 31, 2018 · 5 comments
Closed

AndroidClientHandler doesn't support proxy servers #2123

dominik-weber opened this issue Aug 31, 2018 · 5 comments
Assignees
Milestone

Comments

@dominik-weber
Copy link

@dominik-weber dominik-weber commented Aug 31, 2018

Please add support for HTTP proxy server configuration in AndroidClientHandler :)

@Cheesebaron

This comment has been minimized.

Copy link

@Cheesebaron Cheesebaron commented Oct 2, 2018

This is the related line of code.

java_connection = java_url.OpenConnection ();

This should probably check whether Proxy was set on the HttpClientHandler and use that, then fallback to empty call to OpenConnection() if no proxy was set.

@JonDouglas JonDouglas added this to the d16-0 milestone Oct 30, 2018
grendello added a commit to grendello/xamarin-android that referenced this issue Nov 5, 2018
Fixes: xamarin#2123

Implement proxy support for the Java HTTP client by "translating" the proxy
information specified in `HttpClientHandler.Proxy` to the format accepted and
expected by the Java client. Since the translation may involve a DNS lookup, it
is performed in a separate task. No caching is attempted in our client code.
jonpryor added a commit that referenced this issue Nov 8, 2018
Fixes: #2123

Implement proxy support for `AndroidClientHandler` by "translating"
the proxy information specified in `HttpClientHandler.Proxy` to the
format accepted and expected by the Java client.

Since the translation may involve a DNS lookup, it is performed in a
separate task.

No caching is attempted in our client code.
@dominik-weber

This comment has been minimized.

Copy link
Author

@dominik-weber dominik-weber commented Nov 24, 2018

I know I'm a bit late here, but shouldn't the default behavior (if you just call new AndroidClientHandler() without modifying any properties) be to use the system default proxy? Currently these settings are ignored.
@grendello I think support for using the default proxy could be implemented fairly easily by adding something like this to the GetJavaProxy method:

            URI java_uri = new URI(EncodeUrl(destination));
            proxy = ProxySelector.Default?.Select(java_uri).FirstOrDefault();
@johnthiriet

This comment has been minimized.

Copy link

@johnthiriet johnthiriet commented Apr 23, 2019

I totally agree with @dominik-weber and this is what we have implemented in our project in order to be able to debug network calls with Charles Proxy.

@mzekrallah

This comment has been minimized.

Copy link

@mzekrallah mzekrallah commented May 31, 2019

Any update on this guys ? I find it extremely strange that something as basic and 'core' to any network layer implementation is missing and it has been almost 8 years since Xamarin started !

@grendello

This comment has been minimized.

Copy link
Member

@grendello grendello commented Jul 10, 2019

The proxy should be used only if the Proxy property is not null (and configured for the specified URL) and the UseProxy property is true - which is what we implement.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
6 participants
You can’t perform that action at this time.