diff options
author | Radosław Juszczyk <verianel6869@gmail.com> | 2017-08-25 14:45:07 +0200 |
---|---|---|
committer | Tobrun <tobrun@mapbox.com> | 2017-09-26 11:43:33 +0200 |
commit | 9596940638891b7041587f38f8c1aba19b0a1855 (patch) | |
tree | a3a7328fbc7c648002b3f236b95511393ee5671d | |
parent | 9ed623acb195c7b89028f0d7e1b74e47e5fd1360 (diff) | |
download | qtlocation-mapboxgl-9596940638891b7041587f38f8c1aba19b0a1855.tar.gz |
Do not check connection if it is local request
Requests to servers which run on localhost should be independent from internet connection.
-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 9c8cda5544..7f3a48c57a 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) { |