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

Avoid Proxyception. Bypassing the system proxy on the Android device when testing ping to the proxy. #69

Closed
wants to merge 1 commit into from

Conversation

mike-odom
Copy link

If you have a proxy setup on your device, the previous code for the ping would try to use that proxy, and that proxy would know nothing of the HttpProxyCacheServer. This would cause the ping to fail. And make it impossible to see what is going on with the network using a proxy. This code uses a HttpURLConnection with Proxy.NO_PROXY in order to not get intercepted by the system proxy.

…when testing ping to the proxy.

# Conflicts:
#	library/src/main/java/com/danikula/videocache/HttpProxyCacheServer.java
@jarrodholliday
Copy link

@ThatOdieGuy just wanted to say thanks for this and that I have merged it into my fork as well. If you have any more fixes you can also do a pull request on my fork and I'll merge it in and push it to bintray since you forked my fork @_@ and it looks like the original creator has abandoned the library.

} catch (ProxyCacheException e) {
Log.e(LOG_TAG, "Error reading ping response", e);
//Don't try to use a proxy to access our proxy. Proxyception.
HttpURLConnection connection = (HttpURLConnection) new URL(pingUrl).openConnection(Proxy.NO_PROXY);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you sure this fix resolves issue? Bypassing system proxy allows only ping cacheproxy, but MediaPlayer will not whatever.

@danikula
Copy link
Owner

@jarrodholliday @ThatOdieGuy Are you sure this PR resolves issue? Bypassing system proxy allows only ping cacheproxy, but MediaPlayer will not whatever.

@jarrodholliday
Copy link

@danikula I tested this a bit more and it doesn't really solve the issue. When setting up the proxy on the phone for Charles I just tell it to bypass localhost and that works like a charm.

@danikula
Copy link
Owner

danikula commented Aug 5, 2016

Bypassing system proxy allows only ping cacheproxy, but MediaPlayer will not whatever. Fix doesn't work.

@danikula danikula closed this Aug 5, 2016
@mike-odom
Copy link
Author

Oh, it fixed the problem for us. AndroidVideoCache would just fail right off the bat because it couldn't pass the ping test. I bypassed the Charles proxy using this code and everything worked great. We're not using MediaPlayer though. We're using ExoPlayer. So maybe that's different?

@danikula
Copy link
Owner

danikula commented Aug 6, 2016

@ThatOdieGuy sounds strange. Will check it for MediaPlayer and ExoPlayer. Thanks for info.

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

Successfully merging this pull request may close these issues.

None yet

3 participants