lib/pwned/password_base.rb in pwned-2.1.0 vs lib/pwned/password_base.rb in pwned-2.2.0
- old
+ new
@@ -63,11 +63,11 @@
# @since 1.0.0
attr_reader :hashed_password
private
- attr_reader :request_options, :request_headers
+ attr_reader :request_options, :request_headers, :request_proxy
def fetch_pwned_count
for_each_response_line do |line|
next unless line.start_with?(hashed_password_suffix)
# Count starts after the suffix, followed by a colon
@@ -106,10 +106,18 @@
request = Net::HTTP::Get.new(uri)
request.initialize_http_header(request_headers)
request_options[:use_ssl] = true
- Net::HTTP.start(uri.host, uri.port, request_options) do |http|
+ Net::HTTP.start(
+ uri.host,
+ uri.port,
+ request_proxy&.host,
+ request_proxy&.port,
+ request_proxy&.user,
+ request_proxy&.password,
+ request_options
+ ) do |http|
http.request(request, &block)
end
end
# Stream a Net::HTTPResponse by line, handling lines that cross chunks.