use HTTPS where supported, and on Gingerbread and above (i.e. not android-9)

To increase user privacy, especially with traffic that includes sensitive
information like location and tracking markers, HTTPS should be used
whenever possible.  It seems that HTTPS is broken for a lot of sites on
versions older than android-10/Gingerbread, so HTTPS is not used on those
old platforms.
This commit is contained in:
Hans-Christoph Steiner 2015-01-20 15:28:31 +01:00
parent afc2949e8e
commit 41f356a11a
4 changed files with 23 additions and 6 deletions

View file

@ -67,7 +67,7 @@ public abstract class Entity {
}
public String getOsmUrl() {
final String browseUrl = "http://www.openstreetmap.org/browse/";
final String browseUrl = "https://www.openstreetmap.org/browse/";
if (type == EntityType.NODE)
return browseUrl + "node/" + id;
if (type == EntityType.WAY)

View file

@ -40,7 +40,6 @@ public class DownloadTracker {
return (new Random(System.currentTimeMillis()).nextInt(100000000) + 100000000) + "";
}
static final String beaconUrl = "http://www.google-analytics.com/__utm.gif";
static final String analyticsVersion = "4.3"; // Analytics version - AnalyticsVersion
public void trackEvent(OsmandApplication a,
@ -86,6 +85,12 @@ public class DownloadTracker {
parameters.put("utme", MessageFormat.format("5({0}*{1}*{2})({3})", category, action, label == null ? "" : label, value)
+ customVars);
String scheme = "";
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD)
scheme = "https";
else
scheme = "http";
String beaconUrl = scheme + "://www.google-analytics.com/__utm.gif";
StringBuilder urlString = new StringBuilder(beaconUrl + "?");
Iterator<Entry<String, String>> it = parameters.entrySet().iterator();
while (it.hasNext()) {

View file

@ -67,6 +67,7 @@ import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
import android.content.Context;
import android.os.Build;
import android.os.Bundle;
import btools.routingapp.IBRouterService;
@ -1079,12 +1080,17 @@ public class RouteProvider {
}
protected RouteCalculationResult findOSRMRoute(RouteCalculationParams params)
throws MalformedURLException, IOException, JSONException {
// http://router.project-osrm.org/viaroute?loc=52.28,4.83&loc=52.35,4.95&alt=false&output=gpx
// https://router.project-osrm.org/viaroute?loc=52.28,4.83&loc=52.35,4.95&alt=false&output=gpx
List<Location> res = new ArrayList<Location>();
StringBuilder uri = new StringBuilder();
// possibly hide that API key because it is privacy of osmand
// A6421860EBB04234AB5EF2D049F2CD8F key is compromised
uri.append("http://router.project-osrm.org/viaroute?alt=false"); //$NON-NLS-1$
String scheme = "";
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD)
scheme = "https";
else
scheme = "http";
uri.append(scheme + "://router.project-osrm.org/viaroute?alt=false"); //$NON-NLS-1$
uri.append("&loc=").append(String.valueOf(params.start.getLatitude()));
uri.append(",").append(String.valueOf(params.start.getLongitude()));
if(params.intermediates != null && params.intermediates.size() > 0) {

View file

@ -17,6 +17,7 @@ import org.apache.commons.logging.Log;
import android.graphics.Canvas;
import android.graphics.RectF;
import android.os.Build;
public class YandexTrafficAdapter extends MapTileAdapter {
@ -56,10 +57,15 @@ public class YandexTrafficAdapter extends MapTileAdapter {
}
protected void updateTimeStampImpl() {
String YANDEX_BASE_URL;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD)
YANDEX_BASE_URL = "https://jgo.maps.yandex.net";
else
YANDEX_BASE_URL = "http://jgo.maps.yandex.net";
if (mTimestamp == null || (System.currentTimeMillis() - lastTimestampUpdated) > DELTA) {
log.info("Updating timestamp"); //$NON-NLS-1$
try {
BufferedInputStream in = new BufferedInputStream(new URL("http://jgo.maps.yandex.net/trf/stat.js").openStream(), 1024); //$NON-NLS-1$
BufferedInputStream in = new BufferedInputStream(new URL(YANDEX_BASE_URL + "/trf/stat.js").openStream(), 1024); //$NON-NLS-1$
ByteArrayOutputStream dataStream = new ByteArrayOutputStream();
BufferedOutputStream out = new BufferedOutputStream(dataStream, 1024);
Algorithms.streamCopy(in, out);
@ -82,7 +88,7 @@ public class YandexTrafficAdapter extends MapTileAdapter {
if (!newTimestamp.equals(mTimestamp)) {
mTimestamp = newTimestamp;
TileSourceTemplate template = new TileSourceTemplate(YANDEX_PREFFIX + mTimestamp,
"http://jgo.maps.yandex.net/1.1/tiles?l=trf,trfe&x={1}&y={2}&z={0}&tm=" + mTimestamp, ".png", 17, 7, 256, 8, 18000);
YANDEX_BASE_URL + "/1.1/tiles?l=trf,trfe&x={1}&y={2}&z={0}&tm=" + mTimestamp, ".png", 17, 7, 256, 8, 18000);
template.setEllipticYTile(true);
template.setExpirationTimeMinutes(20);
clearCache();