From: Brett Parker Date: Sat, 23 Jul 2011 12:06:47 +0000 (+0100) Subject: * Add https support (thanks to Andre Klärner) X-Git-Url: https://git.sommitrealweird.co.uk/rss2maildir.git/commitdiff_plain/d4cf848001ab703a452b059b8c17f2a4cb7a19ca * Add https support (thanks to Andre Klärner) --- diff --git a/rss2maildir.py b/rss2maildir.py index a1e8819..b4acdec 100755 --- a/rss2maildir.py +++ b/rss2maildir.py @@ -612,10 +612,17 @@ def open_url(method, url): (type, rest) = urllib.splittype(url) (host, path) = urllib.splithost(rest) (host, port) = urllib.splitport(host) - if port == None: + if type == "https": + if port == None: + port = 443 + elif port == None: port = 80 try: - conn = httplib.HTTPConnection("%s:%s" %(host, port)) + conn = None + if type == "http": + conn = httplib.HTTPConnection("%s:%s" %(host, port)) + else: + conn = httplib.HTTPSConnection("%s:%s" %(host, port)) conn.request(method, path) response = conn.getresponse() if response.status in [301, 302, 303, 307]: