commit rubygem-faraday_middleware for openSUSE:Factory
Hello community, here is the log from the commit of package rubygem-faraday_middleware for openSUSE:Factory checked in at 2017-01-17 14:37:15 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/rubygem-faraday_middleware (Old) and /work/SRC/openSUSE:Factory/.rubygem-faraday_middleware.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Package is "rubygem-faraday_middleware" Changes: -------- --- /work/SRC/openSUSE:Factory/rubygem-faraday_middleware/rubygem-faraday_middleware.changes 2016-12-11 13:27:19.435689640 +0100 +++ /work/SRC/openSUSE:Factory/.rubygem-faraday_middleware.new/rubygem-faraday_middleware.changes 2017-01-17 14:37:16.485689083 +0100 @@ -1,0 +2,6 @@ +Sun Jan 15 05:31:54 UTC 2017 - coolo@suse.com + +- updated to version 0.11.0 + no changelog found + +------------------------------------------------------------------- Old: ---- faraday_middleware-0.10.1.gem New: ---- faraday_middleware-0.11.0.gem ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ rubygem-faraday_middleware.spec ++++++ --- /var/tmp/diff_new_pack.oBDaLC/_old 2017-01-17 14:37:16.953622748 +0100 +++ /var/tmp/diff_new_pack.oBDaLC/_new 2017-01-17 14:37:16.953622748 +0100 @@ -1,7 +1,7 @@ # # spec file for package rubygem-faraday_middleware # -# 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_middleware -Version: 0.10.1 +Version: 0.11.0 Release: 0 %define mod_name faraday_middleware %define mod_full_name %{mod_name}-%{version} ++++++ faraday_middleware-0.10.1.gem -> faraday_middleware-0.11.0.gem ++++++ 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_middleware/gzip.rb new/lib/faraday_middleware/gzip.rb --- old/lib/faraday_middleware/gzip.rb 2016-11-11 13:04:59.000000000 +0100 +++ new/lib/faraday_middleware/gzip.rb 2017-01-14 12:39:13.000000000 +0100 @@ -48,7 +48,17 @@ end def inflate(body) + # Inflate as a DEFLATE (RFC 1950+RFC 1951) stream Zlib::Inflate.inflate(body) + rescue Zlib::DataError + # Fall back to inflating as a "raw" deflate stream which + # Microsoft servers return + inflate = Zlib::Inflate.new(-Zlib::MAX_WBITS) + begin + inflate.inflate(body) + ensure + inflate.close + end end end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/faraday_middleware/request/encode_json.rb new/lib/faraday_middleware/request/encode_json.rb --- old/lib/faraday_middleware/request/encode_json.rb 2016-11-11 13:04:59.000000000 +0100 +++ new/lib/faraday_middleware/request/encode_json.rb 2017-01-14 12:39:13.000000000 +0100 @@ -9,8 +9,9 @@ # # Doesn't try to encode bodies that already are in string form. class EncodeJson < Faraday::Middleware - CONTENT_TYPE = 'Content-Type'.freeze - MIME_TYPE = 'application/json'.freeze + CONTENT_TYPE = 'Content-Type'.freeze + MIME_TYPE = 'application/json'.freeze + MIME_TYPE_REGEX = /^application\/(vnd\..+\+)?json$/ dependency do require 'json' unless defined?(::JSON) @@ -36,7 +37,7 @@ def process_request?(env) type = request_type(env) - has_body?(env) and (type.empty? or type == MIME_TYPE) + has_body?(env) and (type.empty? or MIME_TYPE_REGEX =~ type) end def has_body?(env) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/faraday_middleware/request/oauth2.rb new/lib/faraday_middleware/request/oauth2.rb --- old/lib/faraday_middleware/request/oauth2.rb 2016-11-11 13:04:59.000000000 +0100 +++ new/lib/faraday_middleware/request/oauth2.rb 2017-01-14 12:39:13.000000000 +0100 @@ -4,10 +4,11 @@ module FaradayMiddleware # Public: A simple middleware that adds an access token to each request. # - # The token is added as both "access_token" query parameter and the - # "Authorization" HTTP request header. However, an explicit "access_token" - # parameter or "Authorization" header for the current request are not - # overriden. + # By default, the token is added as both "access_token" query parameter and the + # "Authorization" HTTP request header. It can alternatively be added exclusively + # as a bearer token "Authorization" header by specifying a "token_type" option + # of "bearer". However, an explicit "access_token" parameter or "Authorization" + # header for the current request are not overriden. # # Examples # @@ -17,14 +18,18 @@ # # configure query parameter name: # OAuth2.new(app, 'abc123', :param_name => 'my_oauth_token') # + # # use bearer token authorization header only + # OAuth2.new(app, 'abc123', :token_type => 'bearer') + # # # default token value is optional: # OAuth2.new(app, :param_name => 'my_oauth_token') class OAuth2 < Faraday::Middleware PARAM_NAME = 'access_token'.freeze + TOKEN_TYPE = 'param'.freeze AUTH_HEADER = 'Authorization'.freeze - attr_reader :param_name + attr_reader :param_name, :token_type extend Forwardable def_delegators :'Faraday::Utils', :parse_query, :build_query @@ -34,8 +39,13 @@ token = params[param_name] if token.respond_to?(:empty?) && !token.empty? - env[:url].query = build_query params - env[:request_headers][AUTH_HEADER] ||= %(Token token="#{token}") + case @token_type.downcase + when 'param' + env[:url].query = build_query params + env[:request_headers][AUTH_HEADER] ||= %(Token token="#{token}") + when 'bearer' + env[:request_headers][AUTH_HEADER] ||= %(Bearer #{token}) + end end @app.call env @@ -46,7 +56,19 @@ options, token = token, nil if token.is_a? Hash @token = token && token.to_s @param_name = options.fetch(:param_name, PARAM_NAME).to_s - raise ArgumentError, ":param_name can't be blank" if @param_name.empty? + @token_type = options.fetch(:token_type, TOKEN_TYPE).to_s + + if @token_type == 'param' && @param_name.empty? + raise ArgumentError, ":param_name can't be blank" + end + + if options[:token_type].nil? + warn "\nWarning: FaradayMiddleware::OAuth2 initialized with default "\ + "token_type - token will be added as both a query string parameter "\ + "and an Authorization header. In the next major release, tokens will "\ + "be added exclusively as an Authorization header by default. Please "\ + "visit https://github.com/lostisland/faraday_middleware/wiki for more information." + end end def query_params(url) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/faraday_middleware/response/caching.rb new/lib/faraday_middleware/response/caching.rb --- old/lib/faraday_middleware/response/caching.rb 2016-11-11 13:04:59.000000000 +0100 +++ new/lib/faraday_middleware/response/caching.rb 2017-01-14 12:39:13.000000000 +0100 @@ -79,11 +79,11 @@ finalize_response(cached_response, env) else # response.status is nil at this point, any checks need to be done inside on_complete block - @app.call(env).on_complete do |response| - if CACHEABLE_STATUS_CODES.include?(response.status) - cache.write(key, response) + @app.call(env).on_complete do |response_env| + if CACHEABLE_STATUS_CODES.include?(response_env.status) + cache.write(key, response_env.response) end - response + response_env end end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/faraday_middleware/response/follow_redirects.rb new/lib/faraday_middleware/response/follow_redirects.rb --- old/lib/faraday_middleware/response/follow_redirects.rb 2016-11-11 13:04:59.000000000 +0100 +++ new/lib/faraday_middleware/response/follow_redirects.rb 2017-01-14 12:39:13.000000000 +0100 @@ -12,7 +12,7 @@ end end - # Public: Follow HTTP 301, 302, 303, and 307 redirects. + # Public: Follow HTTP 301, 302, 303, 307, and 308 redirects. # # For HTTP 301, 302, and 303, the original GET, POST, PUT, DELETE, or PATCH # request gets converted into a GET. With `:standards_compliant => true`, @@ -34,7 +34,7 @@ # HTTP methods for which 30x redirects can be followed ALLOWED_METHODS = Set.new [:head, :options, :get, :post, :put, :patch, :delete] # HTTP redirect status codes that this middleware implements - REDIRECT_CODES = Set.new [301, 302, 303, 307] + REDIRECT_CODES = Set.new [301, 302, 303, 307, 308] # Keys in env hash which will get cleared between requests ENV_TO_CLEAR = Set.new [:status, :response, :response_headers] @@ -52,6 +52,8 @@ # :standards_compliant - A Boolean indicating whether to respect # the HTTP spec when following 301/302 # (default: false) + # :callback - A callable that will be called on redirects + # with the old and new envs def initialize(app, options = {}) super(app) @options = options @@ -78,7 +80,8 @@ response.on_complete do |response_env| if follow_redirect?(response_env, response) raise RedirectLimitReached, response if follows.zero? - new_request_env = update_env(response_env, request_body, response) + new_request_env = update_env(response_env.dup, request_body, response) + callback.call(response_env, new_request_env) if callback response = perform_with_redirection(new_request_env, follows - 1) end end @@ -113,11 +116,16 @@ @options.fetch(:standards_compliant, false) end + def callback + @options[:callback] + end + # Internal: escapes unsafe characters from an URL which might be a path # component only or a fully qualified URI so that it can be joined onto an # URI:HTTP using the `+` operator. Doesn't escape "%" characters so to not # risk double-escaping. def safe_escape(uri) + uri = uri.split('#')[0] # we want to remove the fragment if present uri.to_s.gsub(URI_UNSAFE) { |match| '%' + match.unpack('H2' * match.bytesize).join('%').upcase } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/faraday_middleware/response_middleware.rb new/lib/faraday_middleware/response_middleware.rb --- old/lib/faraday_middleware/response_middleware.rb 2016-11-11 13:04:59.000000000 +0100 +++ new/lib/faraday_middleware/response_middleware.rb 2017-01-14 12:39:13.000000000 +0100 @@ -37,6 +37,8 @@ def process_response(env) env[:raw_body] = env[:body] if preserve_raw?(env) env[:body] = parse(env[:body]) + rescue Faraday::Error::ParsingError => err + raise Faraday::Error::ParsingError.new(err, env[:response]) end # Parse the response body. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/faraday_middleware/version.rb new/lib/faraday_middleware/version.rb --- old/lib/faraday_middleware/version.rb 2016-11-11 13:04:59.000000000 +0100 +++ new/lib/faraday_middleware/version.rb 2017-01-14 12:39:13.000000000 +0100 @@ -1,3 +1,3 @@ module FaradayMiddleware - VERSION = "0.10.1" unless defined?(FaradayMiddleware::VERSION) + VERSION = "0.11.0" unless defined?(FaradayMiddleware::VERSION) end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/metadata new/metadata --- old/metadata 2016-11-11 13:04:59.000000000 +0100 +++ new/metadata 2017-01-14 12:39:13.000000000 +0100 @@ -1,7 +1,7 @@ --- !ruby/object:Gem::Specification name: faraday_middleware version: !ruby/object:Gem::Version - version: 0.10.1 + version: 0.11.0 platform: ruby authors: - Erik Michaels-Ober @@ -9,7 +9,7 @@ autorequire: bindir: bin cert_chain: [] -date: 2016-11-11 00:00:00.000000000 Z +date: 2017-01-14 00:00:00.000000000 Z dependencies: - !ruby/object:Gem::Dependency name: faraday
participants (1)
-
root@hilbertn.suse.de