diff options
author | Radosław Juszczyk <verianel6869@gmail.com> | 2017-08-25 14:45:07 +0200 |
---|---|---|
committer | Tobrun <tobrun@mapbox.com> | 2017-09-14 07:45:31 +0200 |
commit | 5e63e5704a69bea9f82754fd9712b60246b11407 (patch) | |
tree | 4a1b7b84a32393edac49e71ba96f4c069c3e5c3f /platform | |
parent | f0bf2c94aecf2a657d9338216a5ee9179270370a (diff) | |
download | qtlocation-mapboxgl-5e63e5704a69bea9f82754fd9712b60246b11407.tar.gz |
Do not check connection if it is local request
Requests to servers which run on localhost should be independent from internet connection.
Diffstat (limited to 'platform')
-rw-r--r-- | platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/http/HTTPRequest.java | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/http/HTTPRequest.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/http/HTTPRequest.java index 91a235616a..e2626a026b 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/http/HTTPRequest.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/http/HTTPRequest.java @@ -56,13 +56,14 @@ class HTTPRequest implements Callback { mNativePtr = nativePtr; try { - // Don't try a request if we aren't connected - if (!Mapbox.isConnected()) { + HttpUrl httpUrl = HttpUrl.parse(resourceUrl); + final String host = httpUrl.host().toLowerCase(MapboxConstants.MAPBOX_LOCALE); + + // Don't try a request to remote server if we aren't connected + if (!Mapbox.isConnected() && !host.equals("127.0.0.1") && !host.equals("localhost")) { throw new NoRouteToHostException("No Internet connection available."); } - HttpUrl httpUrl = HttpUrl.parse(resourceUrl); - final String host = httpUrl.host().toLowerCase(MapboxConstants.MAPBOX_LOCALE); if (host.equals("mapbox.com") || host.endsWith(".mapbox.com") || host.equals("mapbox.cn") || host.endsWith(".mapbox.cn")) { if (httpUrl.querySize() == 0) { |