Hello community, here is the log from the commit of package rubygem-faraday for openSUSE:Factory checked in at 2017-01-25 23:28:11 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/rubygem-faraday (Old) and /work/SRC/openSUSE:Factory/.rubygem-faraday.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "rubygem-faraday" Changes: -------- --- /work/SRC/openSUSE:Factory/rubygem-faraday/rubygem-faraday.changes 2017-01-15 11:19:31.334131086 +0100 +++ /work/SRC/openSUSE:Factory/.rubygem-faraday.new/rubygem-faraday.changes 2017-01-25 23:28:12.222738969 +0100 @@ -1,0 +2,6 @@ +Sat Jan 14 05:31:15 UTC 2017 - [email protected] + +- updated to version 0.11.0 + no changelog found + +------------------------------------------------------------------- Old: ---- faraday-0.10.1.gem New: ---- faraday-0.11.0.gem ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ rubygem-faraday.spec ++++++ --- /var/tmp/diff_new_pack.p6Gnk9/_old 2017-01-25 23:28:12.578685314 +0100 +++ /var/tmp/diff_new_pack.p6Gnk9/_new 2017-01-25 23:28:12.586684108 +0100 @@ -1,7 +1,7 @@ # # spec file for package rubygem-faraday # -# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2017 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.10.1 +Version: 0.11.0 Release: 0 %define mod_name faraday %define mod_full_name %{mod_name}-%{version} ++++++ faraday-0.10.1.gem -> faraday-0.11.0.gem ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/README.md new/README.md --- old/README.md 2016-12-30 20:37:33.000000000 +0100 +++ new/README.md 2017-01-13 16:18:44.000000000 +0100 @@ -30,6 +30,14 @@ faraday.adapter Faraday.default_adapter # make requests with Net::HTTP end +# Filter sensitive information from logs with a regex matcher + +conn = Faraday.new(:url => 'http://sushi.com/api_key=s3cr3t') do |faraday| + faraday.response :logger do | logger | + logger.filter(/(api_key=)(\w+)/,'\1[REMOVED]') + end +end + ## GET ## response = conn.get '/nigiri/sake.json' # GET http://sushi.com/nigiri/sake.json 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/em_http.rb new/lib/faraday/adapter/em_http.rb --- old/lib/faraday/adapter/em_http.rb 2016-12-30 20:37:33.000000000 +0100 +++ new/lib/faraday/adapter/em_http.rb 2017-01-13 16:18:44.000000000 +0100 @@ -138,7 +138,7 @@ # TODO: reuse the connection to support pipelining def perform_single_request(env) - req = EventMachine::HttpRequest.new(env[:url], connection_config(env)) + req = create_request(env) req.setup_request(env[:method], request_config(env)).callback { |client| status = client.response_header.status reason = client.response_header.http_reason @@ -150,6 +150,10 @@ } end + def create_request(env) + EventMachine::HttpRequest.new(env[:url], connection_config(env).merge(@connection_options)) + end + def error_message(client) client.error or "request failed" end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/faraday/adapter/em_synchrony.rb new/lib/faraday/adapter/em_synchrony.rb --- old/lib/faraday/adapter/em_synchrony.rb 2016-12-30 20:37:33.000000000 +0100 +++ new/lib/faraday/adapter/em_synchrony.rb 2017-01-13 16:18:44.000000000 +0100 @@ -19,7 +19,7 @@ def call(env) super - request = EventMachine::HttpRequest.new(Utils::URI(env[:url].to_s), connection_config(env)) + request = create_request(env) http_method = env[:method].to_s.downcase.to_sym @@ -87,6 +87,10 @@ raise end end + + def create_request(env) + EventMachine::HttpRequest.new(Utils::URI(env[:url].to_s), connection_config(env).merge(@connection_options)) + end end end end 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 2016-12-30 20:37:33.000000000 +0100 +++ new/lib/faraday/adapter/excon.rb 2017-01-13 16:18:44.000000000 +0100 @@ -3,11 +3,6 @@ class Excon < Faraday::Adapter dependency 'excon' - def initialize(app, connection_options = {}) - @connection_options = connection_options - super(app) - end - def call(env) super @@ -50,7 +45,7 @@ end end - conn = ::Excon.new(env[:url].to_s, opts.merge(@connection_options)) + conn = create_connection(env, opts) resp = conn.request \ :method => env[:method].to_s.upcase, @@ -72,6 +67,10 @@ raise Error::TimeoutError, err end + def create_connection(env, opts) + ::Excon.new(env[:url].to_s, opts.merge(@connection_options)) + end + # TODO: support streaming requests def read_body(env) env[:body].respond_to?(:read) ? env[:body].read : env[:body] 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 2016-12-30 20:37:33.000000000 +0100 +++ new/lib/faraday/adapter/httpclient.rb 2017-01-13 16:18:44.000000000 +0100 @@ -29,6 +29,8 @@ configure_ssl ssl end + configure_client + # TODO Don't stream yet. # https://github.com/nahi/httpclient/pull/90 env[:body] = env[:body].read if env[:body].respond_to? :read @@ -95,6 +97,10 @@ end end + def configure_client + @config_block.call(client) if @config_block + end + def ssl_cert_store(ssl) return ssl[:cert_store] if ssl[:cert_store] # Memoize the cert store so that the same one is passed to 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 2016-12-30 20:37:33.000000000 +0100 +++ new/lib/faraday/adapter/net_http.rb 2017-01-13 16:18:44.000000000 +0100 @@ -32,10 +32,7 @@ super with_net_http_connection(env) do |http| configure_ssl(http, env[:ssl]) if env[:url].scheme == 'https' and env[:ssl] - - req = env[:request] - http.read_timeout = http.open_timeout = req[:timeout] if req[:timeout] - http.open_timeout = req[:open_timeout] if req[:open_timeout] + configure_request(http, env[:request]) begin http_response = perform_request(http, env) @@ -109,6 +106,13 @@ http.ssl_version = ssl[:version] if ssl[:version] end + def configure_request(http, req) + http.read_timeout = http.open_timeout = req[:timeout] if req[:timeout] + http.open_timeout = req[:open_timeout] if req[:open_timeout] + + @config_block.call(http) if @config_block + end + def ssl_cert_store(ssl) return ssl[:cert_store] if ssl[:cert_store] # Use the default cert store by default, i.e. system ca certs 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 2016-12-30 20:37:33.000000000 +0100 +++ new/lib/faraday/adapter/net_http_persistent.rb 2017-01-13 16:18:44.000000000 +0100 @@ -7,8 +7,8 @@ class NetHttpPersistent < NetHttp dependency 'net/http/persistent' - def with_net_http_connection(env) - if proxy = env[:request][:proxy] + def net_http_connection(env) + 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 # awful patch for net-http-persistent 2.8 not unescaping user/password @@ -16,9 +16,10 @@ define_method(:user) { proxy[:user] } define_method(:password) { proxy[:password] } end if proxy[:user] + return Net::HTTP::Persistent.new 'Faraday', proxy_uri end - yield Net::HTTP::Persistent.new 'Faraday', proxy_uri + Net::HTTP::Persistent.new 'Faraday' 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 2016-12-30 20:37:33.000000000 +0100 +++ new/lib/faraday/adapter/patron.rb 2017-01-13 16:18:44.000000000 +0100 @@ -3,11 +3,6 @@ class Patron < Faraday::Adapter dependency 'patron' - def initialize(app, &block) - super(app) - @block = block - end - def call(env) super @@ -73,7 +68,7 @@ def create_session session = ::Patron::Session.new session.insecure = true - @block.call(session) if @block + @config_block.call(session) if @config_block session end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/faraday/adapter.rb new/lib/faraday/adapter.rb --- old/lib/faraday/adapter.rb 2016-12-30 20:37:33.000000000 +0100 +++ new/lib/faraday/adapter.rb 2017-01-13 16:18:44.000000000 +0100 @@ -30,6 +30,12 @@ extend Parallelism self.supports_parallel = false + def initialize(app = nil, opts = {}, &block) + super(app) + @connection_options = opts + @config_block = block + end + def call(env) env.clear_body if env.needs_body? 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 2016-12-30 20:37:33.000000000 +0100 +++ new/lib/faraday/connection.rb 2017-01-13 16:18:44.000000000 +0100 @@ -55,11 +55,11 @@ # :user - String (optional) # :password - String (optional) def initialize(url = nil, options = nil) + options = ConnectionOptions.from(options) unless options and options.is_a?(ConnectionOptions) + if url.is_a?(Hash) - options = options ? options.merge(url) : ConnectionOptions.from(url) + options = options.merge(url) url = options.url - else - options = ConnectionOptions.from(options) end @parallel_manager = nil 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 2016-12-30 20:37:33.000000000 +0100 +++ new/lib/faraday/options.rb 2017-01-13 16:18:44.000000000 +0100 @@ -51,7 +51,14 @@ def merge(value) dup.update(value) end + + # Public + def dup + self.class.from(self) + end + alias clone dup + # Public def fetch(key, *args) unless symbolized_key_set.include?(key.to_sym) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/faraday/request/authorization.rb new/lib/faraday/request/authorization.rb --- old/lib/faraday/request/authorization.rb 2016-12-30 20:37:33.000000000 +0100 +++ new/lib/faraday/request/authorization.rb 2017-01-13 16:18:44.000000000 +0100 @@ -16,8 +16,7 @@ # Internal def self.build_hash(type, hash) - offset = KEY.size + type.size + 3 - comma = ",\n#{' ' * offset}" + comma = ", " values = [] hash.each do |key, value| values << "#{key}=#{value.to_s.inspect}" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/faraday/request/retry.rb new/lib/faraday/request/retry.rb --- old/lib/faraday/request/retry.rb 2016-12-30 20:37:33.000000000 +0100 +++ new/lib/faraday/request/retry.rb 2017-01-13 16:18:44.000000000 +0100 @@ -27,7 +27,7 @@ DEFAULT_CHECK = lambda { |env,exception| false } def self.from(value) - if Fixnum === value + if Integer === value new(value) else super(value) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/faraday/response/logger.rb new/lib/faraday/response/logger.rb --- old/lib/faraday/response/logger.rb 2016-12-30 20:37:33.000000000 +0100 +++ new/lib/faraday/response/logger.rb 2017-01-13 16:18:44.000000000 +0100 @@ -12,22 +12,28 @@ require 'logger' ::Logger.new(STDOUT) end + @filter = [] @options = DEFAULT_OPTIONS.merge(options) + yield self if block_given? end def_delegators :@logger, :debug, :info, :warn, :error, :fatal def call(env) - info "#{env.method} #{env.url.to_s}" - debug('request') { dump_headers env.request_headers } if log_headers?(:request) - debug('request') { dump_body(env[:body]) } if env[:body] && log_body?(:request) + info "#{env.method} #{apply_filters(env.url.to_s)}" + debug('request') { apply_filters( dump_headers env.request_headers ) } if log_headers?(:request) + debug('request') { apply_filters( dump_body(env[:body]) ) } if env[:body] && log_body?(:request) super end def on_complete(env) info('Status') { env.status.to_s } - debug('response') { dump_headers env.response_headers } if log_headers?(:response) - debug('response') { dump_body env[:body] } if env[:body] && log_body?(:response) + debug('response') { apply_filters( dump_headers env.response_headers ) } if log_headers?(:response) + debug('response') { apply_filters( dump_body env[:body] ) } if env[:body] && log_body?(:response) + end + + def filter(filter_word, filter_replacement) + @filter.push([ filter_word, filter_replacement ]) end private @@ -62,5 +68,13 @@ else @options[:bodies] end end + + def apply_filters(output) + @filter.each do |pattern, replacement| + output = output.to_s.gsub(pattern, replacement) + end + output + end + end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/faraday.rb new/lib/faraday.rb --- old/lib/faraday.rb 2016-12-30 20:37:33.000000000 +0100 +++ new/lib/faraday.rb 2017-01-13 16:18:44.000000000 +0100 @@ -14,7 +14,7 @@ # conn.get '/' # module Faraday - VERSION = "0.10.1" + VERSION = "0.11.0" class << self # Public: Gets or sets the root path that Faraday is being loaded from. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/metadata new/metadata --- old/metadata 2016-12-30 20:37:33.000000000 +0100 +++ new/metadata 2017-01-13 16:18:44.000000000 +0100 @@ -1,14 +1,14 @@ --- !ruby/object:Gem::Specification name: faraday version: !ruby/object:Gem::Version - version: 0.10.1 + version: 0.11.0 platform: ruby authors: - Rick Olson autorequire: bindir: bin cert_chain: [] -date: 2016-12-30 00:00:00.000000000 Z +date: 2017-01-13 00:00:00.000000000 Z dependencies: - !ruby/object:Gem::Dependency name: multipart-post
