Hello community, here is the log from the commit of package rubygem-faraday for openSUSE:Factory checked in at 2017-09-26 21:13:58 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/rubygem-faraday (Old) and /work/SRC/openSUSE:Factory/.rubygem-faraday.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "rubygem-faraday" Tue Sep 26 21:13:58 2017 rev:19 rq:520441 version:0.13.1 Changes: -------- --- /work/SRC/openSUSE:Factory/rubygem-faraday/rubygem-faraday.changes 2017-06-08 15:00:36.835254667 +0200 +++ /work/SRC/openSUSE:Factory/.rubygem-faraday.new/rubygem-faraday.changes 2017-09-26 21:14:42.407997951 +0200 @@ -1,0 +2,12 @@ +Sun Sep 3 09:01:16 UTC 2017 - [email protected] + +- updated to version 0.13.1 + no changelog found + +------------------------------------------------------------------- +Thu Aug 3 19:12:53 UTC 2017 - [email protected] + +- updated to version 0.12.2 + no changelog found + +------------------------------------------------------------------- Old: ---- faraday-0.12.1.gem New: ---- faraday-0.13.1.gem ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ rubygem-faraday.spec ++++++ --- /var/tmp/diff_new_pack.RakGsZ/_old 2017-09-26 21:14:43.283874813 +0200 +++ /var/tmp/diff_new_pack.RakGsZ/_new 2017-09-26 21:14:43.287874251 +0200 @@ -24,7 +24,7 @@ # Name: rubygem-faraday -Version: 0.12.1 +Version: 0.13.1 Release: 0 %define mod_name faraday %define mod_full_name %{mod_name}-%{version} ++++++ faraday-0.12.1.gem -> faraday-0.13.1.gem ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/README.md new/README.md --- old/README.md 2017-04-21 18:15:00.000000000 +0200 +++ new/README.md 2017-08-18 19:10:29.000000000 +0200 @@ -2,6 +2,8 @@ [](https://rubygems.org/gems/faraday) [](https://travis-ci.org/lostisland/faraday) +[](https://coveralls.io/github/lostisland/faraday?branch=master) +[](https://codeclimate.com/github/lostisland/faraday) [](https://gitter.im/lostisland/faraday?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge) @@ -42,7 +44,8 @@ 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. +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. +Since the default middleware stack uses url\_encoded middleware and default adapter, use them on building your own middleware stack. ```ruby conn = Faraday.new(:url => 'http://sushi.com') do |faraday| @@ -54,6 +57,7 @@ # Filter sensitive information from logs with a regex matcher conn = Faraday.new(:url => 'http://sushi.com/api_key=s3cr3t') do |faraday| + faraday.request :url_encoded # form-encode POST params faraday.response :logger do | logger | logger.filter(/(api_key=)(\w+)/,'\1[REMOVED]') end @@ -166,6 +170,7 @@ conn.request :multipart conn.request :url_encoded + # Last middleware must be the adapter: conn.adapter :net_http end ``` @@ -310,11 +315,6 @@ stubs.verify_stubbed_calls ``` -## TODO - -* support streaming requests/responses -* better stubbing API - ## Supported Ruby versions This library aims to support and is [tested against][travis] the following Ruby @@ -337,6 +337,12 @@ fashion. If critical issues for a particular implementation exist at the time of a major release, support for that Ruby version may be dropped. +## Contribute + +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) + ## Copyright Copyright (c) 2009-2017 [Rick Olson](mailto:[email protected]), Zack Hobson. 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/httpclient.rb new/lib/faraday/adapter/httpclient.rb --- old/lib/faraday/adapter/httpclient.rb 2017-04-21 18:15:00.000000000 +0200 +++ new/lib/faraday/adapter/httpclient.rb 2017-08-18 19:10:29.000000000 +0200 @@ -50,7 +50,7 @@ else raise Faraday::Error::ClientError, $! end - rescue Errno::ECONNREFUSED, IOError + rescue Errno::ECONNREFUSED, IOError, SocketError raise Faraday::Error::ConnectionFailed, $! rescue => err if defined?(OpenSSL) && OpenSSL::SSL::SSLError === err diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/faraday/adapter/net_http.rb new/lib/faraday/adapter/net_http.rb --- old/lib/faraday/adapter/net_http.rb 2017-04-21 18:15:00.000000000 +0200 +++ new/lib/faraday/adapter/net_http.rb 2017-08-18 19:10:29.000000000 +0200 @@ -87,10 +87,10 @@ def net_http_connection(env) if proxy = env[:request][:proxy] - Net::HTTP::Proxy(proxy[:uri].host, proxy[:uri].port, proxy[:user], proxy[:password]) + Net::HTTP::Proxy(proxy[:uri].hostname, proxy[:uri].port, proxy[:user], proxy[:password]) else Net::HTTP - end.new(env[:url].host, env[:url].port || (env[:url].scheme == 'https' ? 443 : 80)) + end.new(env[:url].hostname, env[:url].port || (env[:url].scheme == 'https' ? 443 : 80)) end def configure_ssl(http, ssl) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/faraday/adapter/net_http_persistent.rb new/lib/faraday/adapter/net_http_persistent.rb --- old/lib/faraday/adapter/net_http_persistent.rb 2017-04-21 18:15:00.000000000 +0200 +++ new/lib/faraday/adapter/net_http_persistent.rb 2017-08-18 19:10:29.000000000 +0200 @@ -8,6 +8,7 @@ dependency 'net/http/persistent' def net_http_connection(env) + proxy_uri = nil if (proxy = env[:request][:proxy]) proxy_uri = ::URI::HTTP === proxy[:uri] ? proxy[:uri].dup : ::URI.parse(proxy[:uri].to_s) proxy_uri.user = proxy_uri.password = nil @@ -16,10 +17,13 @@ define_method(:user) { proxy[:user] } define_method(:password) { proxy[:password] } end if proxy[:user] - return Net::HTTP::Persistent.new 'Faraday', proxy_uri end - Net::HTTP::Persistent.new 'Faraday' + if Net::HTTP::Persistent.instance_method(:initialize).parameters.first == [:key, :name] + Net::HTTP::Persistent.new(name: 'Faraday', proxy: proxy_uri) + else + Net::HTTP::Persistent.new('Faraday', proxy_uri) + end end def perform_request(http, env) 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-04-21 18:15:00.000000000 +0200 +++ new/lib/faraday/adapter/patron.rb 2017-08-18 19:10:29.000000000 +0200 @@ -5,11 +5,11 @@ def call(env) super - # TODO: support streaming requests env[:body] = env[:body].read if env[:body].respond_to? :read session = @session ||= create_session + configure_ssl(session, env[:ssl]) if env[:url].scheme == 'https' and env[:ssl] if req = env[:request] session.timeout = session.connect_timeout = req[:timeout] if req[:timeout] @@ -67,10 +67,17 @@ def create_session session = ::Patron::Session.new - session.insecure = true @config_block.call(session) if @config_block session end + + def configure_ssl(session, ssl) + if ssl.fetch(:verify, true) + session.cacert = ssl[:ca_file] + else + session.insecure = true + end + end end end end 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-04-21 18:15:00.000000000 +0200 +++ new/lib/faraday/connection.rb 2017-08-18 19:10:29.000000000 +0200 @@ -39,6 +39,9 @@ # Public: Sets the default parallel manager for this connection. attr_writer :default_parallel_manager + # Public: Gets or Sets the Hash proxy options. + # attr_reader :proxy + # Public: Initializes a new Faraday::Connection. # # url - URI or String base URL to use as a prefix for all @@ -57,7 +60,7 @@ def initialize(url = nil, options = nil) options = ConnectionOptions.from(options) - if url.is_a?(Hash) + if url.is_a?(Hash) || url.is_a?(ConnectionOptions) options = options.merge(url) url = options.url end @@ -79,23 +82,8 @@ @params.update(options.params) if options.params @headers.update(options.headers) if options.headers - @proxy = nil - proxy(options.fetch(:proxy) { - uri = nil - if URI.parse("").respond_to?(:find_proxy) - case url - when String - uri = URI.parse(url).find_proxy - when URI - uri = url.find_proxy - when nil - uri = find_default_proxy - end - else - uri = find_default_proxy - end - uri - }) + @proxy = options.proxy ? ProxyOptions.from(options.proxy) : proxy_from_env(url) + @temp_proxy = @proxy yield(self) if block_given? @@ -292,9 +280,15 @@ # Public: Gets or Sets the Hash proxy options. 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' @proxy = ProxyOptions.from(arg) end + # Public: Sets the Hash proxy options. + def proxy=(new_value) + @proxy = ProxyOptions.from(new_value) + end + def_delegators :url_prefix, :scheme, :scheme=, :host, :host=, :port, :port= def_delegator :url_prefix, :path, :path_prefix @@ -376,7 +370,14 @@ raise ArgumentError, "unknown http method: #{method}" 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? + request = build_request(method) do |req| + req.options = req.options.merge(:proxy => @temp_proxy) req.url(url) if url req.headers.update(headers) if headers req.body = body if body @@ -393,7 +394,7 @@ Request.create(method) do |req| req.params = self.params.dup req.headers = self.headers.dup - req.options = self.options.merge(:proxy => self.proxy) + req.options = self.options yield(req) if block_given? end end @@ -443,8 +444,26 @@ headers[Faraday::Request::Authorization::KEY] = header end + def proxy_from_env(url) + uri = nil + if URI.parse('').respond_to?(:find_proxy) + case url + when String + uri = Utils.URI(url) + uri = URI.parse("#{uri.scheme}://#{uri.hostname}").find_proxy + when URI + uri = url.find_proxy + when nil + uri = find_default_proxy + end + else + warn 'no_proxy is unsupported' if ENV['no_proxy'] || ENV['NO_PROXY'] + uri = find_default_proxy + end + ProxyOptions.from(uri) if uri + end + def find_default_proxy - warn 'no_proxy is unsupported' if ENV['no_proxy'] || ENV['NO_PROXY'] uri = ENV['http_proxy'] if uri && !uri.empty? uri = 'http://' + uri if uri !~ /^http/i 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-04-21 18:15:00.000000000 +0200 +++ new/lib/faraday/options.rb 2017-08-18 19:10:29.000000000 +0200 @@ -49,7 +49,7 @@ other.each do |key, other_value| self_value = self.send(key) sub_options = self.class.options_for(key) - new_value = sub_options ? self_value.merge(other_value) : other_value + new_value = (self_value && sub_options && other_value) ? self_value.merge(other_value) : other_value self.send("#{key}=", new_value) unless new_value.nil? end self 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-04-21 18:15:00.000000000 +0200 +++ new/lib/faraday/rack_builder.rb 2017-08-18 19:10:29.000000000 +0200 @@ -84,6 +84,7 @@ use_symbol(Faraday::Middleware, klass, *args, &block) else raise_if_locked + warn_middleware_after_adapter if adapter_set? @handlers << self.class::Handler.new(klass, *args, &block) end end @@ -105,6 +106,7 @@ def insert(index, *args, &block) raise_if_locked index = assert_index(index) + warn_middleware_after_adapter if inserting_after_adapter?(index) handler = self.class::Handler.new(*args, &block) @handlers.insert(index, handler) end @@ -200,6 +202,26 @@ raise StackLocked, "can't modify middleware stack after making a request" if locked? end + def warn_middleware_after_adapter + warn "WARNING: Unexpected middleware set after the adapter. " \ + "This won't be supported from Faraday 1.0." + end + + def adapter_set? + @handlers.any? { |handler| is_adapter?(handler) } + end + + def inserting_after_adapter?(index) + adapter_index = @handlers.find_index { |handler| is_adapter?(handler) } + return false if adapter_index.nil? + + index > adapter_index + end + + def is_adapter?(handler) + handler.klass.ancestors.include? Faraday::Adapter + end + def use_symbol(mod, key, *args, &block) use(mod.lookup_middleware(key), *args, &block) end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/faraday/utils.rb new/lib/faraday/utils.rb --- old/lib/faraday/utils.rb 2017-04-21 18:15:00.000000000 +0200 +++ new/lib/faraday/utils.rb 2017-08-18 19:10:29.000000000 +0200 @@ -10,12 +10,22 @@ new(value) end + def self.allocate + new_self = super + new_self.initialize_names + new_self + end + def initialize(hash = nil) super() @names = {} self.update(hash || {}) end + def initialize_names + @names = {} + end + # on dup/clone, we need to duplicate @names hash def initialize_copy(other) super @@ -95,7 +105,14 @@ def parse(header_string) return unless header_string && !header_string.empty? - header_string.split(/\r\n/). + + headers = header_string.split(/\r\n/) + + # Find the last set of response headers. + start_index = headers.rindex { |x| x.match(/^HTTP\//) } || 0 + last_response = headers.slice(start_index, headers.size) + + last_response. tap { |a| a.shift if a.first.index('HTTP/') == 0 }. # drop the HTTP status line map { |h| h.split(/:\s*/, 2) }.reject { |p| p[0].nil? }. # split key and value, ignore blank lines each { |key, value| @@ -108,14 +125,6 @@ } end - def init_with(coder) - @names = coder['names'] - end - - def encode_with(coder) - coder['names'] = @names - end - protected def names diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/faraday.rb new/lib/faraday.rb --- old/lib/faraday.rb 2017-04-21 18:15:00.000000000 +0200 +++ new/lib/faraday.rb 2017-08-18 19:10:29.000000000 +0200 @@ -14,7 +14,7 @@ # conn.get '/' # module Faraday - VERSION = "0.12.1" + VERSION = "0.13.1" class << self # Public: Gets or sets the root path that Faraday is being loaded from. @@ -109,7 +109,7 @@ # # Returns a Faraday::Connection, configured with the #default_adapter. def self.default_connection - @default_connection ||= Connection.new + @default_connection ||= Connection.new(default_connection_options) end # Gets the default connection options used when calling Faraday#new. @@ -121,6 +121,7 @@ # Public: Sets the default options used when calling Faraday#new. def self.default_connection_options=(options) + @default_connection = nil @default_connection_options = ConnectionOptions.from(options) end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/metadata new/metadata --- old/metadata 2017-04-21 18:15:00.000000000 +0200 +++ new/metadata 2017-08-18 19:10:29.000000000 +0200 @@ -1,14 +1,14 @@ --- !ruby/object:Gem::Specification name: faraday version: !ruby/object:Gem::Version - version: 0.12.1 + version: 0.13.1 platform: ruby authors: - Rick Olson autorequire: bindir: bin cert_chain: [] -date: 2017-04-21 00:00:00.000000000 Z +date: 2017-08-18 00:00:00.000000000 Z dependencies: - !ruby/object:Gem::Dependency name: multipart-post
