aws-sdk-core 3.119.1 → 3.121.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +24 -0
- data/VERSION +1 -1
- data/lib/aws-sdk-core/plugins/protocols/api_gateway.rb +17 -0
- data/lib/aws-sdk-core/plugins/protocols/rest_json.rb +16 -1
- data/lib/aws-sdk-core/rest/request/body.rb +19 -1
- data/lib/aws-sdk-core/shared_config.rb +2 -1
- data/lib/aws-sdk-core/structure.rb +1 -1
- data/lib/aws-sdk-core/xml/parser/engines/rexml.rb +0 -8
- data/lib/aws-sdk-sso/client.rb +1 -3
- data/lib/aws-sdk-sso.rb +1 -1
- data/lib/aws-sdk-sts/client.rb +1 -1
- data/lib/aws-sdk-sts.rb +1 -1
- data/lib/seahorse/client/h2/connection.rb +3 -5
- data/lib/seahorse/client/h2/handler.rb +4 -5
- data/lib/seahorse/client/net_http/handler.rb +15 -7
- data/lib/seahorse/client/net_http/patches.rb +13 -84
- data/lib/seahorse/client/plugins/content_length.rb +11 -5
- metadata +3 -4
- data/lib/aws-sdk-sso/plugins/content_type.rb +0 -25
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4b9f3fb30de8f9941d6f38fba87b19a9a68885fa51f28604481686e9dac1848c
|
4
|
+
data.tar.gz: 258e63026024946722a4bbdaaf34d91b633857a9b0310d735547e1cadfbefd51
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6706b957d3f7649d5886e388fefb261b6863168ac64c1b3e86e2e912dc1d692e60c0349d9c8109afbe9dc594e612e8a4f3f0cd00ab68b7dbfedf1812dd608570
|
7
|
+
data.tar.gz: 67fd627aabe9d7ccb53aec0d5c161d6ce255d51427166e0dfd3370210e1bb08bb242ec4d8632a73bcce006e13288057077e20b148b72092f60720ecd54d00291
|
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,30 @@
|
|
1
1
|
Unreleased Changes
|
2
2
|
------------------
|
3
3
|
|
4
|
+
3.121.2 (2021-10-18)
|
5
|
+
------------------
|
6
|
+
|
7
|
+
* Issue - Fix an issue where Rest JSON services do not have a `Content-Type` header.
|
8
|
+
|
9
|
+
* Issue - Remove blank `Content-Type` header from Net::HTTP handler, and prevent a default from being set.
|
10
|
+
|
11
|
+
* Issue - Set `Content-Length` only for HTTP methods that take a body.
|
12
|
+
|
13
|
+
3.121.1 (2021-09-24)
|
14
|
+
------------------
|
15
|
+
|
16
|
+
* Issue - Fix error in finding union member for boolean shapes with `false` values.
|
17
|
+
|
18
|
+
3.121.0 (2021-09-02)
|
19
|
+
------------------
|
20
|
+
|
21
|
+
* Feature - Add support for S3 Multi-region access point configuration.
|
22
|
+
|
23
|
+
3.120.0 (2021-09-01)
|
24
|
+
------------------
|
25
|
+
|
26
|
+
* Feature - AWS SDK for Ruby no longer supports Ruby runtime versions 1.9, 2.0, 2.1, and 2.2.
|
27
|
+
|
4
28
|
3.119.1 (2021-08-20)
|
5
29
|
------------------
|
6
30
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
3.
|
1
|
+
3.121.2
|
@@ -4,9 +4,26 @@ module Aws
|
|
4
4
|
module Plugins
|
5
5
|
module Protocols
|
6
6
|
class ApiGateway < Seahorse::Client::Plugin
|
7
|
+
|
8
|
+
class ContentTypeHandler < Seahorse::Client::Handler
|
9
|
+
def call(context)
|
10
|
+
body = context.http_request.body
|
11
|
+
# Rest::Handler will set a default JSON body, so size can be checked
|
12
|
+
# if this handler is run after serialization.
|
13
|
+
if !body.respond_to?(:size) ||
|
14
|
+
(body.respond_to?(:size) && body.size > 0)
|
15
|
+
context.http_request.headers['Content-Type'] ||=
|
16
|
+
'application/json'
|
17
|
+
end
|
18
|
+
@handler.call(context)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
7
22
|
handler(Rest::Handler)
|
23
|
+
handler(ContentTypeHandler, priority: 30)
|
8
24
|
handler(Json::ErrorHandler, step: :sign)
|
9
25
|
end
|
26
|
+
|
10
27
|
end
|
11
28
|
end
|
12
29
|
end
|
@@ -5,10 +5,25 @@ module Aws
|
|
5
5
|
module Protocols
|
6
6
|
class RestJson < Seahorse::Client::Plugin
|
7
7
|
|
8
|
+
class ContentTypeHandler < Seahorse::Client::Handler
|
9
|
+
def call(context)
|
10
|
+
body = context.http_request.body
|
11
|
+
# Rest::Handler will set a default JSON body, so size can be checked
|
12
|
+
# if this handler is run after serialization.
|
13
|
+
if !body.respond_to?(:size) ||
|
14
|
+
(body.respond_to?(:size) && body.size > 0)
|
15
|
+
context.http_request.headers['Content-Type'] ||=
|
16
|
+
'application/json'
|
17
|
+
end
|
18
|
+
@handler.call(context)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
8
22
|
handler(Rest::Handler)
|
23
|
+
handler(ContentTypeHandler, priority: 30)
|
9
24
|
handler(Json::ErrorHandler, step: :sign)
|
10
|
-
|
11
25
|
end
|
26
|
+
|
12
27
|
end
|
13
28
|
end
|
14
29
|
end
|
@@ -17,11 +17,29 @@ module Aws
|
|
17
17
|
# @param [Seahorse::Client::Http::Request] http_req
|
18
18
|
# @param [Hash] params
|
19
19
|
def apply(http_req, params)
|
20
|
-
|
20
|
+
body = build_body(params)
|
21
|
+
# for rest-json, ensure we send at least an empty object
|
22
|
+
# don't send an empty object for streaming? case.
|
23
|
+
if body.nil? && @serializer_class == Json::Builder &&
|
24
|
+
modeled_body? && !streaming?
|
25
|
+
body = '{}'
|
26
|
+
end
|
27
|
+
http_req.body = body
|
21
28
|
end
|
22
29
|
|
23
30
|
private
|
24
31
|
|
32
|
+
# operation is modeled for body when it is modeled for a payload
|
33
|
+
# either with payload trait or normal members.
|
34
|
+
def modeled_body?
|
35
|
+
return true if @rules[:payload]
|
36
|
+
@rules.shape.members.each do |member|
|
37
|
+
_name, shape = member
|
38
|
+
return true if shape.location.nil?
|
39
|
+
end
|
40
|
+
false
|
41
|
+
end
|
42
|
+
|
25
43
|
def build_body(params)
|
26
44
|
if streaming?
|
27
45
|
params[@rules[:payload]]
|
@@ -1,16 +1,8 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
use_system_rexml = ((RUBY_VERSION <=> "2.0.0") < 0)
|
4
|
-
if use_system_rexml
|
5
|
-
require "rbconfig"
|
6
|
-
$LOAD_PATH.unshift(RbConfig::CONFIG["rubylibdir"])
|
7
|
-
end
|
8
|
-
|
9
3
|
require 'rexml/document'
|
10
4
|
require 'rexml/streamlistener'
|
11
5
|
|
12
|
-
$LOAD_PATH.shift if use_system_rexml
|
13
|
-
|
14
6
|
module Aws
|
15
7
|
module Xml
|
16
8
|
class Parser
|
data/lib/aws-sdk-sso/client.rb
CHANGED
@@ -29,7 +29,6 @@ require 'aws-sdk-core/plugins/transfer_encoding.rb'
|
|
29
29
|
require 'aws-sdk-core/plugins/http_checksum.rb'
|
30
30
|
require 'aws-sdk-core/plugins/signature_v4.rb'
|
31
31
|
require 'aws-sdk-core/plugins/protocols/rest_json.rb'
|
32
|
-
require 'aws-sdk-sso/plugins/content_type.rb'
|
33
32
|
|
34
33
|
Aws::Plugins::GlobalConfiguration.add_identifier(:sso)
|
35
34
|
|
@@ -76,7 +75,6 @@ module Aws::SSO
|
|
76
75
|
add_plugin(Aws::Plugins::HttpChecksum)
|
77
76
|
add_plugin(Aws::Plugins::SignatureV4)
|
78
77
|
add_plugin(Aws::Plugins::Protocols::RestJson)
|
79
|
-
add_plugin(Aws::SSO::Plugins::ContentType)
|
80
78
|
|
81
79
|
# @overload initialize(options)
|
82
80
|
# @param [Hash] options
|
@@ -523,7 +521,7 @@ module Aws::SSO
|
|
523
521
|
params: params,
|
524
522
|
config: config)
|
525
523
|
context[:gem_name] = 'aws-sdk-core'
|
526
|
-
context[:gem_version] = '3.
|
524
|
+
context[:gem_version] = '3.121.2'
|
527
525
|
Seahorse::Client::Request.new(handlers, context)
|
528
526
|
end
|
529
527
|
|
data/lib/aws-sdk-sso.rb
CHANGED
data/lib/aws-sdk-sts/client.rb
CHANGED
@@ -2303,7 +2303,7 @@ module Aws::STS
|
|
2303
2303
|
params: params,
|
2304
2304
|
config: config)
|
2305
2305
|
context[:gem_name] = 'aws-sdk-core'
|
2306
|
-
context[:gem_version] = '3.
|
2306
|
+
context[:gem_version] = '3.121.2'
|
2307
2307
|
Seahorse::Client::Request.new(handlers, context)
|
2308
2308
|
end
|
2309
2309
|
|
data/lib/aws-sdk-sts.rb
CHANGED
@@ -74,8 +74,9 @@ module Seahorse
|
|
74
74
|
# @return [void]
|
75
75
|
def transmit(config, req, resp)
|
76
76
|
session(config, req) do |http|
|
77
|
+
# Monkey patch default content-type set by Net::HTTP
|
78
|
+
Thread.current[:net_http_skip_default_content_type] = true
|
77
79
|
http.request(build_net_request(req)) do |net_resp|
|
78
|
-
|
79
80
|
status_code = net_resp.code.to_i
|
80
81
|
headers = extract_headers(net_resp)
|
81
82
|
|
@@ -96,6 +97,9 @@ module Seahorse
|
|
96
97
|
rescue => error
|
97
98
|
# not retryable
|
98
99
|
resp.signal_error(error)
|
100
|
+
ensure
|
101
|
+
# ensure we turn off monkey patch in case of error
|
102
|
+
Thread.current[:net_http_skip_default_content_type] = nil
|
99
103
|
end
|
100
104
|
|
101
105
|
def complete_response(req, resp, bytes_received)
|
@@ -147,7 +151,12 @@ module Seahorse
|
|
147
151
|
def build_net_request(request)
|
148
152
|
request_class = net_http_request_class(request)
|
149
153
|
req = request_class.new(request.endpoint.request_uri, headers(request))
|
150
|
-
|
154
|
+
# Net::HTTP adds a default Content-Type when a body is present.
|
155
|
+
# Set the body stream when it has an unknown size or when it is > 0.
|
156
|
+
if !request.body.respond_to?(:size) ||
|
157
|
+
(request.body.respond_to?(:size) && request.body.size > 0)
|
158
|
+
req.body_stream = request.body
|
159
|
+
end
|
151
160
|
req
|
152
161
|
end
|
153
162
|
|
@@ -166,14 +175,13 @@ module Seahorse
|
|
166
175
|
# @return [Hash] Returns a vanilla hash of headers to send with the
|
167
176
|
# HTTP request.
|
168
177
|
def headers(request)
|
169
|
-
# Net::HTTP adds default
|
170
|
-
#
|
171
|
-
# this.
|
178
|
+
# Net::HTTP adds a default header for accept-encoding (2.0.0+).
|
179
|
+
# Setting a default empty value defeats this.
|
172
180
|
#
|
173
|
-
# Removing
|
181
|
+
# Removing this is necessary for most services to not break request
|
174
182
|
# signatures as well as dynamodb crc32 checks (these fail if the
|
175
183
|
# response is gzipped).
|
176
|
-
headers = { '
|
184
|
+
headers = { 'accept-encoding' => '' }
|
177
185
|
request.headers.each_pair do |key, value|
|
178
186
|
headers[key] = value
|
179
187
|
end
|
@@ -11,97 +11,26 @@ module Seahorse
|
|
11
11
|
module Patches
|
12
12
|
|
13
13
|
def self.apply!
|
14
|
+
Net::HTTPGenericRequest.prepend(PatchDefaultContentType)
|
14
15
|
return unless RUBY_VERSION < '2.5'
|
15
|
-
if RUBY_VERSION >= '2.3'
|
16
|
-
Net::HTTP::IDEMPOTENT_METHODS_.clear
|
17
|
-
return
|
18
|
-
end
|
19
|
-
# no further patches needed for above versions
|
20
16
|
|
21
|
-
|
22
|
-
Net::HTTP.send(:include, Ruby_2)
|
23
|
-
Net::HTTP::IDEMPOTENT_METHODS_.clear
|
24
|
-
elsif RUBY_VERSION >= '1.9.3'
|
25
|
-
Net::HTTP.send(:include, Ruby_1_9_3)
|
26
|
-
end
|
27
|
-
Net::HTTP.send(:alias_method, :old_transport_request, :transport_request)
|
28
|
-
Net::HTTP.send(:alias_method, :transport_request, :new_transport_request)
|
17
|
+
Net::HTTP::IDEMPOTENT_METHODS_.clear
|
29
18
|
end
|
30
19
|
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
res.uri = req.uri
|
44
|
-
|
45
|
-
res
|
46
|
-
}
|
47
|
-
res.reading_body(@socket, req.response_body_permitted?) {
|
48
|
-
yield res if block_given?
|
49
|
-
}
|
50
|
-
rescue Net::OpenTimeout
|
51
|
-
raise
|
52
|
-
rescue Net::ReadTimeout, IOError, EOFError,
|
53
|
-
Errno::ECONNRESET, Errno::ECONNABORTED, Errno::EPIPE,
|
54
|
-
# avoid a dependency on OpenSSL
|
55
|
-
defined?(OpenSSL::SSL) ? OpenSSL::SSL::SSLError : IOError,
|
56
|
-
Timeout::Error => exception
|
57
|
-
if count == 0 && Net::HTTP::IDEMPOTENT_METHODS_.include?(req.method)
|
58
|
-
count += 1
|
59
|
-
@socket.close if @socket and not @socket.closed?
|
60
|
-
D "Conn close because of error #{exception}, and retry"
|
61
|
-
if req.body_stream
|
62
|
-
if req.body_stream.respond_to?(:rewind)
|
63
|
-
req.body_stream.rewind
|
64
|
-
else
|
65
|
-
raise
|
66
|
-
end
|
67
|
-
end
|
68
|
-
retry
|
69
|
-
end
|
70
|
-
D "Conn close because of error #{exception}"
|
71
|
-
@socket.close if @socket and not @socket.closed?
|
72
|
-
raise
|
73
|
-
end
|
74
|
-
|
75
|
-
end_transport req, res
|
76
|
-
res
|
77
|
-
rescue => exception
|
78
|
-
D "Conn close because of error #{exception}"
|
79
|
-
@socket.close if @socket and not @socket.closed?
|
80
|
-
raise exception
|
20
|
+
# For requests with bodys, Net::HTTP sets a default content type of:
|
21
|
+
# 'application/x-www-form-urlencoded'
|
22
|
+
# There are cases where we should not send content type at all.
|
23
|
+
# Even when no body is supplied, Net::HTTP uses a default empty body
|
24
|
+
# and sets it anyway. This patch disables the behavior when a Thread
|
25
|
+
# local variable is set.
|
26
|
+
module PatchDefaultContentType
|
27
|
+
def supply_default_content_type
|
28
|
+
return if Thread.current[:net_http_skip_default_content_type]
|
29
|
+
|
30
|
+
super
|
81
31
|
end
|
82
32
|
end
|
83
33
|
|
84
|
-
module Ruby_1_9_3
|
85
|
-
def new_transport_request(req)
|
86
|
-
begin_transport req
|
87
|
-
res = catch(:response) {
|
88
|
-
req.exec @socket, @curr_http_version, edit_path(req.path)
|
89
|
-
begin
|
90
|
-
res = Net::HTTPResponse.read_new(@socket)
|
91
|
-
end while res.kind_of?(Net::HTTPContinue)
|
92
|
-
res
|
93
|
-
}
|
94
|
-
res.reading_body(@socket, req.response_body_permitted?) {
|
95
|
-
yield res if block_given?
|
96
|
-
}
|
97
|
-
end_transport req, res
|
98
|
-
res
|
99
|
-
rescue => exception
|
100
|
-
D "Conn close because of error #{exception}"
|
101
|
-
@socket.close if @socket and not @socket.closed?
|
102
|
-
raise exception
|
103
|
-
end
|
104
|
-
end
|
105
34
|
end
|
106
35
|
end
|
107
36
|
end
|
@@ -7,16 +7,22 @@ module Seahorse
|
|
7
7
|
|
8
8
|
# @api private
|
9
9
|
class Handler < Client::Handler
|
10
|
+
# https://github.com/ruby/net-http/blob/master/lib/net/http/requests.rb
|
11
|
+
# Methods without body are forwards compatible, because content-length
|
12
|
+
# may be set for requests without body but is technically incorrect.
|
13
|
+
METHODS_WITHOUT_BODY = Set.new(
|
14
|
+
%w[GET HEAD DELETE OPTIONS TRACE COPY MOVE]
|
15
|
+
)
|
10
16
|
|
11
17
|
def call(context)
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
18
|
+
body = context.http_request.body
|
19
|
+
method = context.http_request.http_method
|
20
|
+
# We use Net::HTTP with body_stream which doesn't do this by default
|
21
|
+
if body.respond_to?(:size) && !METHODS_WITHOUT_BODY.include?(method)
|
22
|
+
context.http_request.headers['Content-Length'] = body.size
|
16
23
|
end
|
17
24
|
@handler.call(context)
|
18
25
|
end
|
19
|
-
|
20
26
|
end
|
21
27
|
|
22
28
|
handler(Handler, step: :sign, priority: 0)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: aws-sdk-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.121.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Amazon Web Services
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-10-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jmespath
|
@@ -230,7 +230,6 @@ files:
|
|
230
230
|
- lib/aws-sdk-sso/client_api.rb
|
231
231
|
- lib/aws-sdk-sso/customizations.rb
|
232
232
|
- lib/aws-sdk-sso/errors.rb
|
233
|
-
- lib/aws-sdk-sso/plugins/content_type.rb
|
234
233
|
- lib/aws-sdk-sso/resource.rb
|
235
234
|
- lib/aws-sdk-sso/types.rb
|
236
235
|
- lib/aws-sdk-sts.rb
|
@@ -300,7 +299,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
300
299
|
requirements:
|
301
300
|
- - ">="
|
302
301
|
- !ruby/object:Gem::Version
|
303
|
-
version: '
|
302
|
+
version: '2.3'
|
304
303
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
305
304
|
requirements:
|
306
305
|
- - ">="
|
@@ -1,25 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Aws
|
4
|
-
module SSO
|
5
|
-
module Plugins
|
6
|
-
class ContentType < Seahorse::Client::Plugin
|
7
|
-
|
8
|
-
def add_handlers(handlers, config)
|
9
|
-
handlers.add(Handler)
|
10
|
-
end
|
11
|
-
|
12
|
-
class Handler < Seahorse::Client::Handler
|
13
|
-
def call(context)
|
14
|
-
# Some operations break when given an empty content-type header.
|
15
|
-
# The SDK adds this blank content-type header
|
16
|
-
# since Net::HTTP provides a default that can break services.
|
17
|
-
# We're setting one here even though it's not used or necessary.
|
18
|
-
context.http_request.headers['content-type'] = 'application/json'
|
19
|
-
@handler.call(context)
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|