Nicoseiga: rewrite tests and fix several bugs
* Fixed a bug where manga posts with a single tag would raise an error * Fixed a bug where dic.nicovideo.jp/oekaki posts weren't uploadable due to SSL issues * Added support for more manga corner cases
This commit is contained in:
@@ -40,7 +40,7 @@ module Danbooru
|
||||
attr_accessor :max_size, :http
|
||||
|
||||
class << self
|
||||
delegate :get, :head, :put, :post, :delete, :cache, :follow, :max_size, :timeout, :auth, :basic_auth, :headers, :cookies, :use, :public_only, :download_media, to: :new
|
||||
delegate :get, :head, :put, :post, :delete, :cache, :follow, :max_size, :timeout, :auth, :basic_auth, :headers, :cookies, :use, :public_only, :with_legacy_ssl, :download_media, to: :new
|
||||
end
|
||||
|
||||
def initialize
|
||||
@@ -136,6 +136,18 @@ module Danbooru
|
||||
end
|
||||
end
|
||||
|
||||
# allow requests to sites using unsafe legacy renegotiations (such as dic.nicovideo.jp)
|
||||
# see https://github.com/openssl/openssl/commit/72d2670bd21becfa6a64bb03fa55ad82d6d0c0f3
|
||||
def with_legacy_ssl
|
||||
dup.tap do |o|
|
||||
o.http = o.http.dup.tap do |http|
|
||||
ctx = OpenSSL::SSL::SSLContext.new
|
||||
ctx.options |= OpenSSL::SSL::OP_LEGACY_SERVER_CONNECT
|
||||
http.default_options = http.default_options.with_ssl_context(ctx)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
concerning :DownloadMethods do
|
||||
# Download a file from `url` and return a {MediaFile}.
|
||||
#
|
||||
|
||||
Reference in New Issue
Block a user