Merge branch 'master' of github.com:r888888888/danbooru

This commit is contained in:
albert
2013-02-23 11:40:08 -05:00
4 changed files with 40 additions and 4 deletions

View File

@@ -41,8 +41,8 @@ module Downloads
limit = 4
while true
unless url.is_a?(URI::HTTP)
raise Error.new("URL must be HTTP")
unless url.is_a?(URI::HTTP) || url.is_a?(URI::HTTPS)
raise Error.new("URL must be HTTP or HTTPS")
end
headers = {
@@ -50,7 +50,7 @@ module Downloads
}
@source, headers = before_download(source, headers)
Net::HTTP.start(url.host, url.port) do |http|
Net::HTTP.start(url.host, url.port, :use_ssl => url.is_a?(URI::HTTPS)) do |http|
http.read_timeout = 10
http.request_get(url.request_uri, headers) do |res|
case res

View File

@@ -247,7 +247,7 @@ class Upload < ActiveRecord::Base
module DownloaderMethods
# Determines whether the source is downloadable
def is_downloadable?
source =~ /^http:\/\// && file_path.blank?
source =~ /^https?:\/\// && file_path.blank?
end
# Downloads the file to destination_path