Hello community, here is the log from the commit of package rubygem-faraday for openSUSE:Factory checked in at 2018-02-10 17:59:59 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/rubygem-faraday (Old) and /work/SRC/openSUSE:Factory/.rubygem-faraday.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "rubygem-faraday" Sat Feb 10 17:59:59 2018 rev:20 rq:574930 version:0.14.0 Changes: -------- --- /work/SRC/openSUSE:Factory/rubygem-faraday/rubygem-faraday.changes 2017-09-26 21:14:42.407997951 +0200 +++ /work/SRC/openSUSE:Factory/.rubygem-faraday.new/rubygem-faraday.changes 2018-02-10 18:00:00.652127729 +0100 @@ -1,0 +2,6 @@ +Thu Feb 8 06:01:18 UTC 2018 - [email protected] + +- updated to version 0.14.0 + no changelog found + +------------------------------------------------------------------- Old: ---- faraday-0.13.1.gem New: ---- faraday-0.14.0.gem ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ rubygem-faraday.spec ++++++ --- /var/tmp/diff_new_pack.FRXdxF/_old 2018-02-10 18:00:02.364065756 +0100 +++ /var/tmp/diff_new_pack.FRXdxF/_new 2018-02-10 18:00:02.368065611 +0100 @@ -1,7 +1,7 @@ # # spec file for package rubygem-faraday # -# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -24,7 +24,7 @@ # Name: rubygem-faraday -Version: 0.13.1 +Version: 0.14.0 Release: 0 %define mod_name faraday %define mod_full_name %{mod_name}-%{version} @@ -33,7 +33,7 @@ BuildRequires: %{rubygem gem2rpm} BuildRequires: ruby-macros >= 5 Url: https://github.com/lostisland/faraday -Source: http://rubygems.org/gems/%{mod_full_name}.gem +Source: https://rubygems.org/gems/%{mod_full_name}.gem Source1: gem2rpm.yml Summary: HTTP/REST API client library License: MIT ++++++ faraday-0.13.1.gem -> faraday-0.14.0.gem ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/README.md new/README.md --- old/README.md 2017-08-18 19:10:29.000000000 +0200 +++ new/README.md 2018-01-19 20:19:34.000000000 +0100 @@ -11,7 +11,7 @@ adapters (such as Net::HTTP) and embraces the concept of Rack middleware when processing the request/response cycle. -Faraday supports these adapters: +Faraday supports these adapters out of the box: * [Net::HTTP][net_http] _(default)_ * [Net::HTTP::Persistent][persistent] @@ -20,6 +20,10 @@ * [EventMachine][] * [HTTPClient][] +Adapters are slowly being moved into their own gems, or bundled with HTTP clients: + +* [Typhoeus][] + It also includes a Rack adapter for hitting loaded Rack applications through Rack::Test, and a Test adapter for stubbing requests by hand. @@ -40,8 +44,8 @@ A more flexible way to use Faraday is to start with a Connection object. If you want to keep the same defaults, you can use this syntax: ```ruby -conn = Faraday.new(:url => 'http://www.example.com') -response = conn.get '/users' # GET http://www.example.com/users' +conn = Faraday.new(:url => 'http://www.example.com') +response = conn.get '/users' # GET http://www.example.com/users' ``` Connections can also take an options hash as a parameter or be configured by using a block. Checkout the section called [Advanced middleware usage](#advanced-middleware-usage) for more details about how to use this block for configurations. @@ -145,7 +149,7 @@ get serialized. The default encoder is Faraday::NestedParamsEncoder. ## Authentication - + Basic and Token authentication are handled by Faraday::Request::BasicAuthentication and Faraday::Request::TokenAuthentication respectively. These can be added as middleware manually or through the helper methods. ```ruby @@ -154,10 +158,26 @@ end Faraday.new(...) do |conn| - conn.token_auth('authentication-token') + conn.token_auth('authentication-token') end ``` +## Proxy + +Faraday will try to automatically infer the proxy settings from your system using `URI#find_proxy`. +This will retrieve them from environment variables such as http_proxy, ftp_proxy, no_proxy, etc. +If for any reason you want to disable this behaviour, you can do so by setting the global varibale `ignore_env_proxy`: + +```ruby +Faraday.ignore_env_proxy = true +``` + +You can also specify a custom proxy when initializing the connection + +```ruby +Faraday.new('http://www.example.com', :proxy => 'http://proxy.com') +``` + ## Advanced middleware usage The order in which middleware is stacked is important. Like with Rack, the @@ -235,7 +255,7 @@ ## Ad-hoc adapters customization -Faraday is intended to be a generic interface between your code and the adapter. However, sometimes you need to access a feature specific to one of the adapters that is not covered in Faraday's interface. +Faraday is intended to be a generic interface between your code and the adapter. However, sometimes you need to access a feature specific to one of the adapters that is not covered in Faraday's interface. When that happens, you can pass a block when specifying the adapter to customize it. The block parameter will change based on the adapter you're using. See below for some examples. @@ -341,7 +361,7 @@ Do you want to contribute to Faraday? Open the issues page and check for the `any volunteer?` label! -But before you start coding, please read our [Contributing Guide](https://github.com/lostisland/faraday/blob/master/CONTRIBUTING.md) +But before you start coding, please read our [Contributing Guide](https://github.com/lostisland/faraday/blob/master/.github/CONTRIBUTING.md) ## Copyright @@ -355,6 +375,7 @@ [patron]: http://toland.github.io/patron/ [eventmachine]: https://github.com/igrigorik/em-http-request#readme [httpclient]: https://github.com/nahi/httpclient +[typhoeus]: https://github.com/typhoeus/typhoeus/blob/master/lib/typhoeus/adapters/faraday.rb [jruby]: http://jruby.org/ [rubinius]: http://rubini.us/ [license]: LICENSE.md Binary files old/checksums.yaml.gz and new/checksums.yaml.gz differ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/faraday/adapter/excon.rb new/lib/faraday/adapter/excon.rb --- old/lib/faraday/adapter/excon.rb 2017-08-18 19:10:29.000000000 +0200 +++ new/lib/faraday/adapter/excon.rb 2018-01-19 20:19:34.000000000 +0100 @@ -30,7 +30,6 @@ if req[:open_timeout] opts[:connect_timeout] = req[:open_timeout] - opts[:write_timeout] = req[:open_timeout] end if req[:proxy] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/faraday/adapter/patron.rb new/lib/faraday/adapter/patron.rb --- old/lib/faraday/adapter/patron.rb 2017-08-18 19:10:29.000000000 +0200 +++ new/lib/faraday/adapter/patron.rb 2018-01-19 20:19:34.000000000 +0100 @@ -37,7 +37,7 @@ @app.call env rescue ::Patron::TimeoutError => err - if err.message == "Connection time-out" + if connection_timed_out_message?(err.message) raise Faraday::Error::ConnectionFailed, err else raise Faraday::Error::TimeoutError, err @@ -78,6 +78,23 @@ session.insecure = true end end + + private + + CURL_TIMEOUT_MESSAGES = [ "Connection time-out", + "Connection timed out", + "Timed out before name resolve", + "server connect has timed out", + "Resolving timed out", + "name lookup timed out", + "timed out before SSL", + "connect() timed out" + ].freeze + + def connection_timed_out_message?(message) + CURL_TIMEOUT_MESSAGES.any? { |curl_message| message.include?(curl_message) } + end + end end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/faraday/adapter/test.rb new/lib/faraday/adapter/test.rb --- old/lib/faraday/adapter/test.rb 2017-08-18 19:10:29.000000000 +0200 +++ new/lib/faraday/adapter/test.rb 2018-01-19 20:19:34.000000000 +0100 @@ -53,17 +53,17 @@ @stack.empty? end - def match(request_method, path, headers, body) + def match(request_method, host, path, headers, body) return false if [email protected]?(request_method) stack = @stack[request_method] consumed = (@consumed[request_method] ||= []) - stub, meta = matches?(stack, path, headers, body) + stub, meta = matches?(stack, host, path, headers, body) if stub consumed << stack.delete(stub) return stub, meta end - matches?(consumed, path, headers, body) + matches?(consumed, host, path, headers, body) end def get(path, headers = {}, &block) @@ -110,29 +110,35 @@ protected def new_stub(request_method, path, headers = {}, body=nil, &block) - normalized_path = path.is_a?(Regexp) ? path : Faraday::Utils.normalize_path(path) - (@stack[request_method] ||= []) << Stub.new(normalized_path, headers, body, block) + normalized_path, host = + if path.is_a?(Regexp) + path + else + [Faraday::Utils.normalize_path(path), Faraday::Utils.URI(path).host] + end + + (@stack[request_method] ||= []) << Stub.new(host, normalized_path, headers, body, block) end - def matches?(stack, path, headers, body) + def matches?(stack, host, path, headers, body) stack.each do |stub| - match_result, meta = stub.matches?(path, headers, body) + match_result, meta = stub.matches?(host, path, headers, body) return stub, meta if match_result end nil end end - class Stub < Struct.new(:path, :params, :headers, :body, :block) - def initialize(full, headers, body, block) + class Stub < Struct.new(:host, :path, :params, :headers, :body, :block) + def initialize(host, full, headers, body, block) path, query = full.respond_to?(:split) ? full.split("?") : full params = query ? Faraday::Utils.parse_nested_query(query) : {} - super(path, params, headers, body, block) + super(host, path, params, headers, body, block) end - def matches?(request_uri, request_headers, request_body) + def matches?(request_host, request_uri, request_headers, request_body) request_path, request_query = request_uri.split('?') request_params = request_query ? Faraday::Utils.parse_nested_query(request_query) : @@ -140,7 +146,8 @@ # meta is a hash use as carrier # that will be yielded to consumer block meta = {} - return path_match?(request_path, meta) && + return (host.nil? || host == request_host) && + path_match?(request_path, meta) && params_match?(request_params) && (body.to_s.size.zero? || request_body == body) && headers_match?(request_headers), meta @@ -183,10 +190,11 @@ def call(env) super + host = env[:url].host normalized_path = Faraday::Utils.normalize_path(env[:url]) params_encoder = env.request.params_encoder || Faraday::Utils.default_params_encoder - stub, meta = stubs.match(env[:method], normalized_path, env.request_headers, env[:body]) + stub, meta = stubs.match(env[:method], host, normalized_path, env.request_headers, env[:body]) if stub env[:params] = (query = env[:url].query) ? params_encoder.decode(query) : {} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/faraday/adapter/typhoeus.rb new/lib/faraday/adapter/typhoeus.rb --- old/lib/faraday/adapter/typhoeus.rb 2017-08-18 19:10:29.000000000 +0200 +++ new/lib/faraday/adapter/typhoeus.rb 2018-01-19 20:19:34.000000000 +0100 @@ -1,123 +1,12 @@ module Faraday class Adapter + # This class is just a stub, the real adapter is in https://github.com/philsturgeon/typhoeus/blob/master/lib/typhoeus/adapters/faraday.rb class Typhoeus < Faraday::Adapter - self.supports_parallel = true - - def self.setup_parallel_manager(options = {}) - options.empty? ? ::Typhoeus::Hydra.hydra : ::Typhoeus::Hydra.new(options) - end + # Needs to define this method in order to support Typhoeus <= 1.3.0 + def call; end dependency 'typhoeus' - - def call(env) - super - perform_request env - @app.call env - end - - def perform_request(env) - read_body env - - hydra = env[:parallel_manager] || self.class.setup_parallel_manager - hydra.queue request(env) - hydra.run unless parallel?(env) - rescue Errno::ECONNREFUSED - raise Error::ConnectionFailed, $! - end - - # TODO: support streaming requests - def read_body(env) - env[:body] = env[:body].read if env[:body].respond_to? :read - end - - def request(env) - method = env[:method] - # For some reason, prevents Typhoeus from using "100-continue". - # We want this because Webrick 1.3.1 can't seem to handle it w/ PUT. - method = method.to_s.upcase if method == :put - - req = ::Typhoeus::Request.new env[:url].to_s, - :method => method, - :body => env[:body], - :headers => env[:request_headers], - :disable_ssl_peer_verification => (env[:ssl] && env[:ssl].disable?) - - configure_ssl req, env - configure_proxy req, env - configure_timeout req, env - configure_socket req, env - - req.on_complete do |resp| - if resp.timed_out? - if parallel?(env) - # TODO: error callback in async mode - else - raise Faraday::Error::TimeoutError, "request timed out" - end - end - - case resp.curl_return_code - when 0 - # everything OK - when 7 - raise Error::ConnectionFailed, resp.curl_error_message - when 60 - raise Faraday::SSLError, resp.curl_error_message - else - raise Error::ClientError, resp.curl_error_message - end - - save_response(env, resp.code, resp.body) do |response_headers| - response_headers.parse resp.headers - end - # in async mode, :response is initialized at this point - env[:response].finish(env) if parallel?(env) - end - - req - end - - def configure_ssl(req, env) - ssl = env[:ssl] - - req.ssl_version = ssl[:version] if ssl[:version] - req.ssl_cert = ssl[:client_cert] if ssl[:client_cert] - req.ssl_key = ssl[:client_key] if ssl[:client_key] - req.ssl_cacert = ssl[:ca_file] if ssl[:ca_file] - req.ssl_capath = ssl[:ca_path] if ssl[:ca_path] - end - - def configure_proxy(req, env) - proxy = request_options(env)[:proxy] - return unless proxy - - req.proxy = "#{proxy[:uri].host}:#{proxy[:uri].port}" - - if proxy[:user] && proxy[:password] - req.proxy_username = proxy[:user] - req.proxy_password = proxy[:password] - end - end - - def configure_timeout(req, env) - env_req = request_options(env) - req.timeout = req.connect_timeout = (env_req[:timeout] * 1000) if env_req[:timeout] - req.connect_timeout = (env_req[:open_timeout] * 1000) if env_req[:open_timeout] - end - - def configure_socket(req, env) - if bind = request_options(env)[:bind] - req.interface = bind[:host] - end - end - - def request_options(env) - env[:request] - end - - def parallel?(env) - !!env[:parallel_manager] - end + dependency 'typhoeus/adapters/faraday' end end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/faraday/autoload.rb new/lib/faraday/autoload.rb --- old/lib/faraday/autoload.rb 2017-08-18 19:10:29.000000000 +0200 +++ new/lib/faraday/autoload.rb 2018-01-19 20:19:34.000000000 +0100 @@ -53,9 +53,9 @@ autoload_all 'faraday/adapter', :NetHttp => 'net_http', :NetHttpPersistent => 'net_http_persistent', - :Typhoeus => 'typhoeus', :EMSynchrony => 'em_synchrony', :EMHttp => 'em_http', + :Typhoeus => 'typhoeus', :Patron => 'patron', :Excon => 'excon', :Test => 'test', diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/faraday/connection.rb new/lib/faraday/connection.rb --- old/lib/faraday/connection.rb 2017-08-18 19:10:29.000000000 +0200 +++ new/lib/faraday/connection.rb 2018-01-19 20:19:34.000000000 +0100 @@ -82,6 +82,7 @@ @params.update(options.params) if options.params @headers.update(options.headers) if options.headers + @manual_proxy = !!options.proxy @proxy = options.proxy ? ProxyOptions.from(options.proxy) : proxy_from_env(url) @temp_proxy = @proxy @@ -281,12 +282,14 @@ def proxy(arg = nil) return @proxy if arg.nil? warn 'Warning: use of proxy(new_value) to set connection proxy have been DEPRECATED and will be removed in Faraday 1.0' + @manual_proxy = true @proxy = ProxyOptions.from(arg) end # Public: Sets the Hash proxy options. def proxy=(new_value) - @proxy = ProxyOptions.from(new_value) + @manual_proxy = true + @proxy = new_value ? ProxyOptions.from(new_value) : nil end def_delegators :url_prefix, :scheme, :scheme=, :host, :host=, :port, :port= @@ -307,7 +310,7 @@ # # conn.get("nigiri?page=2") # accesses https://sushi.com/api/nigiri # - # Returns the parsed URI from teh given input.. + # Returns the parsed URI from the given input.. def url_prefix=(url, encoder = nil) uri = @url_prefix = Utils.URI(url) self.path_prefix = uri.path @@ -371,10 +374,7 @@ end # Resets temp_proxy - @temp_proxy = self.proxy - - # Set temporary proxy if request url is absolute - @temp_proxy = proxy_from_env(url) if url && Utils.URI(url).absolute? + @temp_proxy = proxy_for_request(url) request = build_request(method) do |req| req.options = req.options.merge(:proxy => @temp_proxy) @@ -445,6 +445,7 @@ end def proxy_from_env(url) + return if Faraday.ignore_env_proxy uri = nil if URI.parse('').respond_to?(:find_proxy) case url @@ -470,5 +471,14 @@ uri end end + + def proxy_for_request(url) + return self.proxy if @manual_proxy + if url && Utils.URI(url).absolute? + proxy_from_env(url) + else + self.proxy + end + end end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/faraday/options.rb new/lib/faraday/options.rb --- old/lib/faraday/options.rb 2017-08-18 19:10:29.000000000 +0200 +++ new/lib/faraday/options.rb 2018-01-19 20:19:34.000000000 +0100 @@ -243,8 +243,8 @@ super(value) end - memoized(:user) { uri.user && Utils.unescape(uri.user) } - memoized(:password) { uri.password && Utils.unescape(uri.password) } + memoized(:user) { uri && uri.user && Utils.unescape(uri.user) } + memoized(:password) { uri && uri.password && Utils.unescape(uri.password) } end class ConnectionOptions < Options.new(:request, :proxy, :ssl, :builder, :url, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/faraday/rack_builder.rb new/lib/faraday/rack_builder.rb --- old/lib/faraday/rack_builder.rb 2017-08-18 19:10:29.000000000 +0200 +++ new/lib/faraday/rack_builder.rb 2018-01-19 20:19:34.000000000 +0100 @@ -138,6 +138,8 @@ # # Returns a Faraday::Response. def build_response(connection, request) + warn 'WARNING: No adapter was configured for this request' unless adapter_set? + app.call(build_env(connection, request)) end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/faraday.rb new/lib/faraday.rb --- old/lib/faraday.rb 2017-08-18 19:10:29.000000000 +0200 +++ new/lib/faraday.rb 2018-01-19 20:19:34.000000000 +0100 @@ -14,7 +14,7 @@ # conn.get '/' # module Faraday - VERSION = "0.13.1" + VERSION = "0.14.0" class << self # Public: Gets or sets the root path that Faraday is being loaded from. @@ -34,6 +34,9 @@ # Faraday.get "https://faraday.com" attr_writer :default_connection + # Public: Tells faraday to ignore the environment proxy (http_proxy). + attr_accessor :ignore_env_proxy + # Public: Initializes a new Faraday::Connection. # # url - The optional String base URL to use as a prefix for all @@ -101,6 +104,7 @@ end end + self.ignore_env_proxy = false self.root_path = File.expand_path "..", __FILE__ self.lib_path = File.expand_path "../faraday", __FILE__ self.default_adapter = :net_http diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/metadata new/metadata --- old/metadata 2017-08-18 19:10:29.000000000 +0200 +++ new/metadata 2018-01-19 20:19:34.000000000 +0100 @@ -1,14 +1,14 @@ --- !ruby/object:Gem::Specification name: faraday version: !ruby/object:Gem::Version - version: 0.13.1 + version: 0.14.0 platform: ruby authors: - Rick Olson autorequire: bindir: bin cert_chain: [] -date: 2017-08-18 00:00:00.000000000 Z +date: 2018-01-19 00:00:00.000000000 Z dependencies: - !ruby/object:Gem::Dependency name: multipart-post @@ -92,7 +92,7 @@ version: '0' requirements: [] rubyforge_project: -rubygems_version: 2.4.5 +rubygems_version: 2.7.4 signing_key: specification_version: 4 summary: HTTP/REST API client library.
