Faradayμ νκ²½ λ³μ νλ‘μ μ€μ (http_proxy, https_proxy, no_proxy)μ μ¬μ μνλ λ°©λ²μ΄ μλμ§ νμ
ν μ μμ΅λλ€. Faraday.new
μΈμ λ° κ΅¬μ± λΈλ‘μμ proxy=nil
μ€μ μ μλνμ§λ§ μλνμ§ μλ κ² κ°μ΅λλ€.
> c = Faraday.new('https://www.google.com', proxy: nil)
=> #<Faraday::Connection:0x00007fd1e2176180 @parallel_manager=nil, @headers={"User-Agent"=>"Faraday v0.13.1"}, @params={}, @options=#<Faraday::RequestOptions (empty)>, @ssl=#<Faraday::SSLOptions (empty)>, @default_parallel_manager=nil, @builder=#<Faraday::RackBuilder:0x00007fd1e2175d20 @handlers=[Faraday::Request::UrlEncoded, Faraday::Adapter::NetHttp]>, @url_prefix=#<URI::HTTPS https://www.google.com/>, @proxy=#<Faraday::ProxyOptions uri=#<URI::HTTP http://127.0.0.1:3128/>>, @temp_proxy=#<Faraday::ProxyOptions uri=#<URI::HTTP http://127.0.0.1:3128/>>>
> c = Faraday.new('https://www.google.com') { |c| c.proxy=nil
c.adapter :net_http
}
(Object doesn't support #inspect)
> c = Faraday.new('https://www.google.com', proxy: '')
=> #<Faraday::Connection:0x00007fd1e28f2300 @parallel_manager=nil, @headers={"User-Agent"=>"Faraday v0.13.1"}, @params={}, @options=#<Faraday::RequestOptions (empty)>, @ssl=#<Faraday::SSLOptions (empty)>, @default_parallel_manager=nil, @builder=#<Faraday::RackBuilder:0x00007fd1e28f1d60 @handlers=[Faraday::Request::UrlEncoded, Faraday::Adapter::NetHttp]>, @url_prefix=#<URI::HTTPS https://www.google.com/>, @proxy=#<Faraday::ProxyOptions uri=#<URI::Generic >>, @temp_proxy=#<Faraday::ProxyOptions uri=#<URI::Generic >>>
> c = Faraday.new('https://www.google.com/') { |co|
2.4.2 :025 > co.proxy = ''
2.4.2 :026?> co.adapter :net_http
2.4.2 :027?> }
=> #<Faraday::Connection:0x00007fe0af1bd4c8 @parallel_manager=nil, @headers={"User-Agent"=>"Faraday v0.13.1"}, @params={}, @options=#<Faraday::RequestOptions (empty)>, @ssl=#<Faraday::SSLOptions (empty)>, @default_parallel_manager=nil, @builder=#<Faraday::RackBuilder:0x00007fe0af1bd1d0 @handlers=[Faraday::Adapter::NetHttp]>, @url_prefix=#<URI::HTTPS https://nexus-gss.uscis.dhs.gov/>, @proxy=#<Faraday::ProxyOptions uri=#<URI::Generic >>, @temp_proxy=#<Faraday::ProxyOptions uri=#<URI::HTTP http://127.0.0.1:3128/>>>
κ·Έ λ§μ§λ§ κ²°κ³Όλ ProxyOptions.from(URI::Generic)
λλ νλ‘μλ‘ ν λΉλλ κ²κ³Ό κ°μΌλ©° μ¬μ ν nilμ΄ μλ νλ‘μλ₯Ό μμ±ν©λλ€.
https://github.com/lostisland/faraday/blob/master/lib/faraday/adapter/net_http.rb#L88 -L94
μ΄ μ¬κ±΄μ μ λλ‘ μ²λ¦¬νμ§ λͺ»νλ κ² κ°μ΅λλ€. μ΄λ€ μμ΄λμ΄?
(μ½λ λ€μ΄λΉ μ€μ μ΅μ ꡬ문 λΆμμ΄ λͺ μμ nil μ€μ μ μ μ²λ¦¬νμ§ λͺ»νλ κ² κ°μμ΅λλ€)
μλ νμΈμ @jeffb-stellλ,
λ΄ μ΄ν΄λ ν¨λ¬λ°μ΄μ λν νκ²½ νλ‘μ κ°μ 무μνλ €λ κ²μ
λλ€.
μ κ·Έλ κ² νκ³ μΆμμ§ μ μ΄ν΄κ° μ λμ§λ§, μ§κΈκΉμ§ κ·Έλ° κ²½μ°λ κ³ λ €λμ§ μμ κ² κ°μ΅λλ€.
μ΄λ―Έ μ€μ€λ‘ μμλλ―μ΄ nil
λ₯Ό μ λ¬νλ©΄ ProxyOptionsκ° μ½κ° μ΄μν΄μ§λ©° μ΄κ²μ΄ μ루μ
μ΄ μλνμ§ μλ μ΄μ μ
λλ€.
PRλ‘ μ΄ λ¬Έμ λ₯Ό ν΄κ²°ν μλ μμ§λ§ Faraday 0.14.0 λλ 0.14.1μ΄ λ¦΄λ¦¬μ€λ λλ§ μ¬μ©ν μ μμΌλ―λ‘ μκ°μ΄ λλ©΄ κΈ°λ€λ Έλ€κ° μ
λ°μ΄νΈν΄μΌ ν©λλ€(PR κ²ν κΈ°μ¬νκ³ μΆλ€λ©΄!).
κ·Έ λμ κ°λ₯ν λΉ λ₯Έ μμ μ ENV λ³μλ₯Ό μ¬μ μνμ¬ μ ν리μΌμ΄μ
μ μμνλ κ²μ
λλ€. μμνλ λ° μ¬μ©νλ λͺ
λ Ή μμ env -u http_proxy
λ₯Ό μΆκ°νκΈ°
# For the Ruby console
env -u http_proxy irb
# For Rails
env -u http_proxy rails
μλ νμΈμ @iMacTia ,
κ°μ λ¬Έμ λ μ λ§ λ³ν / λΉνμ±ν μ무κ²λ μΆμ§λ§νμ§ μμ΅λλ€μ warn
μ no_proxy
ENV (https://github.com/lostisland/faraday/blob/4d1ddc130bd224adf25a19eaf0e81fd236a47285/lib/ faraday/connection.rb#L460) κΈ°λ³Έμ μΌλ‘ macOSμ λ컀 컨ν
μ΄λ λ΄λΆμμ ν¨λ¬λ°μ΄(λλ 보μ)λ₯Ό μ¬μ©ν λ no_proxy
νκ²½μ΄ νμλ©λλ€. https://docs.docker.com/docker -for-mac/networking/ λ무 λ§μ κ²½κ³ ....
λλ₯Ό μν μ΅μμ μ루μ λλ Faradayμ κ°μ μ¬νμ 무μμ λκΉ? (곧 PR μ μ κ°λ₯)
ENV['FARADAY_SILENCE_INTERNAL_WARNINGS']
μ κ°μ΄ λͺ
μμ μ΄λΌκ³ ν μ μμ΅λκΉ?
λλ @guille-moeλ RUBYOPT=-W0
- warn
λ΄λ΄ 침묡νμ§λ§ μ¬μ© μ¬λ‘μμλ μ€μ©μ μ΄μ§ μμ΅λκΉ?
@guille-moe @jeffb-stell λ¬Έμ λ₯Ό μμ ν κ³νμΈ μ루μ μ μ¬μ©νλ©΄ ν΄λΉ κ²½κ³ λ₯Ό ꡬ체μ μΌλ‘ 침묡μν¬ μλ μμ΅λλ€.
@guille-moe @jeffb-stell
#754μ μλ‘μ΄ μ€μ μ λμ
νμ΅λλ€. μ΄μ λ€μκ³Ό κ°μ΄ env νλ‘μ κ°μ§λ₯Ό λΉνμ±νν μ μμ΅λλ€.
Faraday.ignore_env_proxy = true # new setting, defaults to false
ENV['http_proxy'] = 'http://test.proxy.com:80'
conn = Faraday::Connection.new(....)
# conn will NOT use the env proxy
μμ§ PRμ λ³ν©νμ§ μμμ΅λλ€. λͺ λΆ μ λ μκ°μ λ΄μ΄ μμ© νλ‘κ·Έλ¨μ ν
μ€νΈν μ μλ€λ©΄ λ³ν©νλ λ° λ μμ κ°μ κ°κ² λ κ²μ
λλ€. π
μΆκ° ν
μ€νΈμ λν μ μλ νμν©λλ€ π
κ°μ₯ μ μ©ν λκΈ
@guille-moe @jeffb-stell λ¬Έμ λ₯Ό μμ ν κ³νμΈ μ루μ μ μ¬μ©νλ©΄ ν΄λΉ κ²½κ³ λ₯Ό ꡬ체μ μΌλ‘ 침묡μν¬ μλ μμ΅λλ€.