summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRadosław Juszczyk <verianel6869@gmail.com>2017-08-25 14:45:07 +0200
committerTobrun Van Nuland <tobrun.van.nuland@gmail.com>2017-09-12 10:50:27 +0200
commit3f5c1f12b03ecc266b1a1501df3d797efade0397 (patch)
tree3273aa9d49afabc5432ddd91178ff395f06359b0
parent8e01f52dd212c57646a9b0fa1c65039a003b78cc (diff)
downloadqtlocation-mapboxgl-upstream/external-pr-rjuszczyk.tar.gz
Do not check connection if it is local requestupstream/external-pr-rjuszczyk
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.java9
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) {