http 6.0.2-java → 6.0.4-java
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/http.gemspec +1 -1
- data/lib/http/connection.rb +1 -1
- data/lib/http/features/instrumentation.rb +2 -2
- data/lib/http/features/logging.rb +1 -1
- data/lib/http/request/builder.rb +21 -1
- data/lib/http/response.rb +2 -2
- data/lib/http/timeout/null.rb +5 -3
- data/lib/http/uri/parsing.rb +2 -2
- data/lib/http/version.rb +1 -1
- data/sig/http.rbs +1 -0
- data/sig/llhttp.rbs +20 -0
- data/sig/manifest.yaml +13 -0
- metadata +7 -5
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: d2fea08e3e5a60cfe0914e0ea94f64a064f711a9819b6f9d0780700794c1b922
|
|
4
|
+
data.tar.gz: '039011ec074fe464297bbd3e999e42e98b016c344bd02e06665302db1a13c53b'
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 9d235dc5f0933ac4305ad0bee1d629c41c44bdfe6cf2b1537e673293d1f7b7821906791745372b83f05a5c8dd6a7c62761dabcb5b2ce8da1633b6e884ad169b7
|
|
7
|
+
data.tar.gz: bec5ef03868ed94e26f733d47ecfa588966a0ecf4e346e8ceec2a7e348736cc02ef18f6fc89623a7a444b87d5d0190515e3484ffbcaa49d3cfcaeaf470723faa
|
data/http.gemspec
CHANGED
|
@@ -26,7 +26,7 @@ Gem::Specification.new do |spec|
|
|
|
26
26
|
spec.metadata["rubygems_mfa_required"] = "true"
|
|
27
27
|
|
|
28
28
|
spec.files = IO.popen(%w[git ls-files -z], chdir: __dir__, err: IO::NULL) do |ls|
|
|
29
|
-
extras = %w[LICENSE.txt README.md sig/http.rbs] << File.basename(__FILE__)
|
|
29
|
+
extras = %w[LICENSE.txt README.md sig/http.rbs sig/llhttp.rbs sig/manifest.yaml] << File.basename(__FILE__)
|
|
30
30
|
|
|
31
31
|
ls.readlines("\x0", chomp: true).select do |f|
|
|
32
32
|
f.start_with?("lib/") || extras.include?(f)
|
data/lib/http/connection.rb
CHANGED
|
@@ -254,7 +254,7 @@ module HTTP
|
|
|
254
254
|
# @return [void]
|
|
255
255
|
# @api private
|
|
256
256
|
def connect_socket(req, options)
|
|
257
|
-
@socket = options.timeout_class.new(**options.timeout_options)
|
|
257
|
+
@socket = options.timeout_class.new(**options.timeout_options)
|
|
258
258
|
@socket.connect(options.socket_class, req.socket_host, req.socket_port, nodelay: options.nodelay)
|
|
259
259
|
|
|
260
260
|
send_proxy_connect_request(req)
|
|
@@ -14,8 +14,8 @@ module HTTP
|
|
|
14
14
|
#
|
|
15
15
|
# Emits two events on every request:
|
|
16
16
|
#
|
|
17
|
-
# * `start_request.http` before the request is made, so you can log the
|
|
18
|
-
# * `request.http` after the response is
|
|
17
|
+
# * `start_request.http` before the request is made, so you can log the request being started
|
|
18
|
+
# * `request.http` after the response is received, and contains `start`
|
|
19
19
|
# and `finish` so the duration of the request can be calculated.
|
|
20
20
|
#
|
|
21
21
|
class Instrumentation < Feature
|
|
@@ -158,7 +158,7 @@ module HTTP
|
|
|
158
158
|
# @return [HTTP::Response::Body]
|
|
159
159
|
# @api private
|
|
160
160
|
def logged_body(body)
|
|
161
|
-
formatter = (method(:format_binary) unless body.loggable?)
|
|
161
|
+
formatter = (method(:format_binary) unless body.loggable?)
|
|
162
162
|
stream = BodyLogger.new(body.instance_variable_get(:@stream), logger, formatter: formatter) # steep:ignore
|
|
163
163
|
Response::Body.new(stream, encoding: body.encoding)
|
|
164
164
|
end
|
data/lib/http/request/builder.rb
CHANGED
|
@@ -81,7 +81,7 @@ module HTTP
|
|
|
81
81
|
# @return [HTTP::URI] the constructed URI
|
|
82
82
|
# @api private
|
|
83
83
|
def make_request_uri(uri)
|
|
84
|
-
uri = uri.to_s
|
|
84
|
+
uri = neutralize_protocol_relative(uri.to_s)
|
|
85
85
|
|
|
86
86
|
if @options.base_uri? && uri !~ HTTP_OR_HTTPS_RE
|
|
87
87
|
uri = resolve_against_base(uri)
|
|
@@ -101,6 +101,26 @@ module HTTP
|
|
|
101
101
|
uri
|
|
102
102
|
end
|
|
103
103
|
|
|
104
|
+
# Neutralize a leading "//" so it resolves as a relative path under base
|
|
105
|
+
#
|
|
106
|
+
# A "//"-prefixed input is a protocol-relative (network-path) reference
|
|
107
|
+
# per RFC 3986 §4.2 / §5.2. On the base_uri branch it would replace the
|
|
108
|
+
# base authority via URI#join; on the persistent branch naive
|
|
109
|
+
# concatenation produces "scheme://persistent//evil/path" which
|
|
110
|
+
# HTTP::URI.parse normalises into scheme://evil/path. Prepending "./"
|
|
111
|
+
# forces the input to resolve as an ordinary relative path under the
|
|
112
|
+
# configured base.
|
|
113
|
+
#
|
|
114
|
+
# @param uri [String] the input URI
|
|
115
|
+
# @return [String] uri unchanged, or "./" + uri when neutralization applies
|
|
116
|
+
# @api private
|
|
117
|
+
def neutralize_protocol_relative(uri)
|
|
118
|
+
return uri unless @options.base_uri? || @options.persistent?
|
|
119
|
+
return uri unless uri.start_with?("//")
|
|
120
|
+
|
|
121
|
+
"./#{uri}"
|
|
122
|
+
end
|
|
123
|
+
|
|
104
124
|
# Resolve a relative URI against the configured base URI
|
|
105
125
|
#
|
|
106
126
|
# Ensures the base URI path has a trailing slash so that relative
|
data/lib/http/response.rb
CHANGED
|
@@ -337,9 +337,9 @@ module HTTP
|
|
|
337
337
|
# @return [HTTP::Request]
|
|
338
338
|
# @api private
|
|
339
339
|
def init_request(request, uri)
|
|
340
|
-
raise ArgumentError, ":uri is for backwards
|
|
340
|
+
raise ArgumentError, ":uri is for backwards compatibility and conflicts with :request" if request && uri
|
|
341
341
|
|
|
342
|
-
# For backwards
|
|
342
|
+
# For backwards compatibility
|
|
343
343
|
if uri
|
|
344
344
|
HTTP::Request.new(uri: uri, verb: :get)
|
|
345
345
|
else
|
data/lib/http/timeout/null.rb
CHANGED
|
@@ -185,12 +185,14 @@ module HTTP
|
|
|
185
185
|
# @return [Object] the connected socket
|
|
186
186
|
# @api private
|
|
187
187
|
def open_socket(socket_class, host, port, connect_timeout: nil)
|
|
188
|
-
|
|
188
|
+
return socket_class.open(host, port) unless connect_timeout
|
|
189
|
+
|
|
190
|
+
if native_timeout?(socket_class)
|
|
191
|
+
open_with_timeout(socket_class, host, port, connect_timeout)
|
|
192
|
+
else
|
|
189
193
|
::Timeout.timeout(connect_timeout, ConnectTimeoutError) do
|
|
190
194
|
open_with_timeout(socket_class, host, port, connect_timeout)
|
|
191
195
|
end
|
|
192
|
-
else
|
|
193
|
-
socket_class.open(host, port)
|
|
194
196
|
end
|
|
195
197
|
rescue IO::TimeoutError
|
|
196
198
|
raise ConnectTimeoutError, "Connect timed out after #{connect_timeout} seconds"
|
data/lib/http/uri/parsing.rb
CHANGED
|
@@ -171,11 +171,11 @@ module HTTP
|
|
|
171
171
|
# @return [Hash] URI components
|
|
172
172
|
private_class_method def self.parse_with_addressable(uri_string)
|
|
173
173
|
require_addressable
|
|
174
|
-
parsed = Addressable::URI.parse(uri_string)
|
|
174
|
+
parsed = Addressable::URI.parse(uri_string)
|
|
175
175
|
{ scheme: parsed.scheme, user: parsed.user, password: parsed.password,
|
|
176
176
|
host: parsed.host, port: parsed.port, path: parsed.path,
|
|
177
177
|
query: parsed.query, fragment: parsed.fragment }
|
|
178
|
-
rescue Addressable::URI::InvalidURIError
|
|
178
|
+
rescue Addressable::URI::InvalidURIError
|
|
179
179
|
raise InvalidError, "invalid URI: #{uri_string.inspect}"
|
|
180
180
|
end
|
|
181
181
|
end
|
data/lib/http/version.rb
CHANGED
data/sig/http.rbs
CHANGED
|
@@ -818,6 +818,7 @@ module HTTP
|
|
|
818
818
|
private
|
|
819
819
|
|
|
820
820
|
def make_request_uri: (String | URI uri) -> URI
|
|
821
|
+
def neutralize_protocol_relative: (String uri) -> String
|
|
821
822
|
def resolve_against_base: (String uri) -> String
|
|
822
823
|
def merge_query_params!: (URI uri) -> void
|
|
823
824
|
def make_request_headers: () -> Headers
|
data/sig/llhttp.rbs
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# Stubs for llhttp / llhttp-ffi, which do not ship their own RBS signatures.
|
|
2
|
+
# Referenced by `HTTP::Response::Parser`, which is part of the public API.
|
|
3
|
+
|
|
4
|
+
module LLHttp
|
|
5
|
+
class Error < StandardError
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
class Parser
|
|
9
|
+
def initialize: (untyped, ?type: Symbol) -> void
|
|
10
|
+
def reset: () -> void
|
|
11
|
+
def <<: (String) -> void
|
|
12
|
+
def status_code: () -> Integer
|
|
13
|
+
def http_major: () -> Integer
|
|
14
|
+
def http_minor: () -> Integer
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
class Delegate
|
|
18
|
+
def initialize: () -> void
|
|
19
|
+
end
|
|
20
|
+
end
|
data/sig/manifest.yaml
ADDED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: http
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 6.0.
|
|
4
|
+
version: 6.0.4
|
|
5
5
|
platform: java
|
|
6
6
|
authors:
|
|
7
7
|
- Tony Arcieri
|
|
@@ -113,15 +113,17 @@ files:
|
|
|
113
113
|
- lib/http/uri/parsing.rb
|
|
114
114
|
- lib/http/version.rb
|
|
115
115
|
- sig/http.rbs
|
|
116
|
+
- sig/llhttp.rbs
|
|
117
|
+
- sig/manifest.yaml
|
|
116
118
|
homepage: https://github.com/httprb/http
|
|
117
119
|
licenses:
|
|
118
120
|
- MIT
|
|
119
121
|
metadata:
|
|
120
122
|
homepage_uri: https://github.com/httprb/http
|
|
121
|
-
source_code_uri: https://github.com/httprb/http/tree/v6.0.
|
|
123
|
+
source_code_uri: https://github.com/httprb/http/tree/v6.0.4
|
|
122
124
|
bug_tracker_uri: https://github.com/httprb/http/issues
|
|
123
|
-
changelog_uri: https://github.com/httprb/http/blob/v6.0.
|
|
124
|
-
documentation_uri: https://www.rubydoc.info/gems/http/6.0.
|
|
125
|
+
changelog_uri: https://github.com/httprb/http/blob/v6.0.4/CHANGELOG.md
|
|
126
|
+
documentation_uri: https://www.rubydoc.info/gems/http/6.0.4
|
|
125
127
|
rubygems_mfa_required: 'true'
|
|
126
128
|
rdoc_options: []
|
|
127
129
|
require_paths:
|
|
@@ -137,7 +139,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
137
139
|
- !ruby/object:Gem::Version
|
|
138
140
|
version: '0'
|
|
139
141
|
requirements: []
|
|
140
|
-
rubygems_version: 4.0.
|
|
142
|
+
rubygems_version: 4.0.16
|
|
141
143
|
specification_version: 4
|
|
142
144
|
summary: HTTP should be easy
|
|
143
145
|
test_files: []
|