From bfde63f92b2ccbb7835d45e45e12a86c80db95ce Mon Sep 17 00:00:00 2001 From: Edho Arief Date: Sat, 17 Nov 2012 05:55:34 -0800 Subject: [PATCH] Fixed https downloader. --- lib/download.rb | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/download.rb b/lib/download.rb index 18fef547..45ae6982 100644 --- a/lib/download.rb +++ b/lib/download.rb @@ -34,8 +34,12 @@ module Danbooru url.query = Addressable::URI.encode(url.query) end - unless url.scheme == 'http' - raise SocketError, "URL must be HTTP" + unless url.scheme == 'http' or url.scheme == 'https' + raise SocketError, "URL must be HTTP or HTTPS" + end + + unless url.port + url.port = url.scheme == 'https' ? 443 : 80 end http = Net::HTTP.new url.host, url.port