diff --git a/lib/docraptor/api_client.rb b/lib/docraptor/api_client.rb index 0274b07..89c4626 100644 --- a/lib/docraptor/api_client.rb +++ b/lib/docraptor/api_client.rb @@ -111,6 +111,8 @@ def build_request(http_method, path, opts = {}) :sslcert => @config.cert_file, :sslkey => @config.key_file, :verbose => @config.debugging, + :proxy => @config.proxy, + :proxyuserpwd => @config.proxyuserpwd, :followlocation => follow_location } diff --git a/lib/docraptor/configuration.rb b/lib/docraptor/configuration.rb index 00148d3..de7629d 100644 --- a/lib/docraptor/configuration.rb +++ b/lib/docraptor/configuration.rb @@ -133,6 +133,16 @@ class Configuration # https://github.com/typhoeus/ethon/blob/master/lib/ethon/easy/queryable.rb#L96 attr_accessor :params_encoding + # Proxy URL to pass to Typhoeus. + # Default to nil. + attr_accessor :proxy + + # Proxy username & password to pass to Typhoeus. + # Format as `username:password`. + # + # Default to nil. + attr_accessor :proxyuserpwd + attr_accessor :inject_format @@ -155,6 +165,8 @@ def initialize @key_file = nil @timeout = 0 @params_encoding = nil + @proxy = nil + @proxyuserpwd = nil @debugging = false @inject_format = false @force_ending_format = false