danbooru::http: fix SSLError exceptions not being caught.

Bug: The frontpage failed due to a SSL error. We couldn't fetch the
popular tag list from Reportbooru because Reportbooru's SSL certificate
had expired and HTTP.rb raised an SSLError exception that we didn't
catch.

Fix: Convert the SSLError to a 5xx HTTP error to prevent SSL exceptions
from leaking through HTTP.rb.
This commit is contained in:
evazion
2020-06-29 14:14:41 -05:00
parent b85b4b190a
commit f5c9a78797
2 changed files with 21 additions and 5 deletions

View File

@@ -120,11 +120,17 @@ module Danbooru
def request(method, url, **options)
http.send(method, url, **options)
rescue OpenSSL::SSL::SSLError
fake_response(590, "")
rescue ValidatingSocket::ProhibitedIpError
fake_response(597, "")
fake_response(591, "")
rescue HTTP::Redirector::TooManyRedirectsError
fake_response(598, "")
fake_response(596, "")
rescue HTTP::TimeoutError
fake_response(597, "")
rescue HTTP::ConnectionError
fake_response(598, "")
rescue HTTP::Error
fake_response(599, "")
end