start work on outbound proxy stuff
This commit is contained in:
parent
4468b8b8e1
commit
8316c19852
3 changed files with 12 additions and 2 deletions
|
|
@ -47,6 +47,7 @@ module DiasporaFederation
|
||||||
@http_verbose = false
|
@http_verbose = false
|
||||||
@http_redirect_limit = 4
|
@http_redirect_limit = 4
|
||||||
@http_user_agent = "DiasporaFederation/#{DiasporaFederation::VERSION}"
|
@http_user_agent = "DiasporaFederation/#{DiasporaFederation::VERSION}"
|
||||||
|
@http_proxy = nil
|
||||||
|
|
||||||
class << self
|
class << self
|
||||||
# {Callbacks} instance with defined callbacks
|
# {Callbacks} instance with defined callbacks
|
||||||
|
|
@ -128,6 +129,13 @@ module DiasporaFederation
|
||||||
# @return [String] user agent
|
# @return [String] user agent
|
||||||
attr_reader :http_user_agent
|
attr_reader :http_user_agent
|
||||||
|
|
||||||
|
# HTTP proxy address
|
||||||
|
# @overload http_proxy
|
||||||
|
# @return [String] http proxy address
|
||||||
|
# @overload http_proxy=
|
||||||
|
# @param [String] value http proxy address
|
||||||
|
attr_accessor :http_proxy
|
||||||
|
|
||||||
# Configure the federation library
|
# Configure the federation library
|
||||||
#
|
#
|
||||||
# @example
|
# @example
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,8 @@ module DiasporaFederation
|
||||||
method: :post,
|
method: :post,
|
||||||
verbose: DiasporaFederation.http_verbose,
|
verbose: DiasporaFederation.http_verbose,
|
||||||
cainfo: DiasporaFederation.certificate_authorities,
|
cainfo: DiasporaFederation.certificate_authorities,
|
||||||
forbid_reuse: true
|
forbid_reuse: true,
|
||||||
|
proxy: DiasporaFederation.http_proxy
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,8 @@ module DiasporaFederation
|
||||||
private_class_method def self.create_default_connection
|
private_class_method def self.create_default_connection
|
||||||
options = {
|
options = {
|
||||||
request: {timeout: DiasporaFederation.http_timeout},
|
request: {timeout: DiasporaFederation.http_timeout},
|
||||||
ssl: {ca_file: DiasporaFederation.certificate_authorities}
|
ssl: {ca_file: DiasporaFederation.certificate_authorities},
|
||||||
|
proxy: {uri: DiasporaFederation.http_proxy}
|
||||||
}
|
}
|
||||||
|
|
||||||
@connection = Faraday::Connection.new(options) do |builder|
|
@connection = Faraday::Connection.new(options) do |builder|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue