summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorChris Schlaeger <chris@linux.com>2019-06-08 09:32:55 +0200
committerChris Schlaeger <chris@linux.com>2019-06-08 09:32:55 +0200
commitc95fc45408942ef97005444790cc080fbe7e8ae9 (patch)
tree6b47580815244934fc67970f11ceb6b43dfdd172 /lib
parent3d7aa8f14f0c7fbad609e53e33187a7b9181a439 (diff)
downloadpostrunner-c95fc45408942ef97005444790cc080fbe7e8ae9.zip
Fix: Use SSL to download EPO file
Looks like Garmin has disabled the HTTP service and now provides a HTTPS service. We now use SSL to download the EPO file.
Diffstat (limited to 'lib')
-rw-r--r--lib/postrunner/EPO_Downloader.rb8
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/postrunner/EPO_Downloader.rb b/lib/postrunner/EPO_Downloader.rb
index 327bff7..6724dae 100644
--- a/lib/postrunner/EPO_Downloader.rb
+++ b/lib/postrunner/EPO_Downloader.rb
@@ -12,6 +12,7 @@
require 'uri'
require 'net/http'
+require 'net/https'
module PostRunner
@@ -20,7 +21,7 @@ module PostRunner
# devices pick up this file under GARMIN/GARMIN/REMOTESW/EPO.BIN.
class EPO_Downloader
- @@URI = URI('http://omt.garmin.com/Rce/ProtobufApi/EphemerisService/GetEphemerisData')
+ @@URI = URI('https://omt.garmin.com/Rce/ProtobufApi/EphemerisService/GetEphemerisData')
# This is the payload of the POST request. It was taken from
# http://www.kluenter.de/garmin-ephemeris-files-and-linux/. It may contain
# a product ID or serial number.
@@ -33,7 +34,8 @@ module PostRunner
# Create an EPO_Downloader object.
def initialize
- @http = Net::HTTP.new(@@URI.host, @@URI.port)
+ @https = Net::HTTP.new(@@URI.host, @@URI.port)
+ @https.use_ssl = true
@request = Net::HTTP::Post.new(@@URI.path, initheader = @@HEADER)
@request.body = @@POST_DATA
end
@@ -57,7 +59,7 @@ module PostRunner
def get_epo_from_server
begin
- res = @http.request(@request)
+ res = @https.request(@request)
rescue => e
Log.error "Extended Prediction Orbit (EPO) data download error: " +
e.message