Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix HTTP -> HTTPS redirect for SRTM #8

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions Hillup/data/SRTM1.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from math import floor, log
from os import unlink, close, write, chmod, makedirs
from os.path import basename, exists, isdir, join
from httplib import HTTPConnection
from httplib import HTTPConnection, HTTPSConnection
from urlparse import urlparse
from tempfile import mkstemp
from zipfile import ZipFile
Expand Down Expand Up @@ -80,7 +80,7 @@ def datasource(lat, lon, source_dir):
return None

# FIXME for western / southern hemispheres
fmt = 'http://dds.cr.usgs.gov/srtm/version2_1/SRTM1/Region_%02d/N%02dW%03d.hgt.zip'
fmt = 'https://dds.cr.usgs.gov/srtm/version2_1/SRTM1/Region_%02d/N%02dW%03d.hgt.zip'
url = fmt % (reg, abs(lat), abs(lon))

#
Expand Down Expand Up @@ -114,7 +114,7 @@ def datasource(lat, lon, source_dir):
#
print >> stderr, 'Retrieving', url, 'in DEM.SRTM1.datasource().'

conn = HTTPConnection(host, 80)
conn = HTTPSConnection(host)
conn.request('GET', path)
resp = conn.getresponse()

Expand Down
8 changes: 4 additions & 4 deletions Hillup/data/SRTM3.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
from math import floor, log
from os import unlink, close, write, chmod, makedirs
from os.path import basename, exists, isdir, join
from httplib import HTTPConnection
from httplib import HTTPConnection, HTTPSConnection
from urlparse import urlparse
from tempfile import mkstemp
from zipfile import ZipFile
Expand Down Expand Up @@ -174,7 +174,7 @@ def datasource(lat, lon, source_dir):
# we're probably outside a known region
return None

fmt = 'http://dds.cr.usgs.gov/srtm/version2_1/SRTM3/%s/%s.hgt.zip'
fmt = 'https://dds.cr.usgs.gov/srtm/version2_1/SRTM3/%s/%s.hgt.zip'
url = fmt % (reg, filename(lat, lon))

#
Expand Down Expand Up @@ -208,7 +208,7 @@ def datasource(lat, lon, source_dir):
#
print >> stderr, 'Retrieving', url, 'in DEM.SRTM3.datasource().'

conn = HTTPConnection(host, 80)
conn = HTTPSConnection(host)
conn.request('GET', path)
resp = conn.getresponse()

Expand Down Expand Up @@ -256,4 +256,4 @@ def datasources(minlon, minlat, maxlon, maxlat, source_dir):
if __name__ == '__main__':

import doctest
doctest.testmod()
doctest.testmod()