http 6.0.3-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/lib/http/features/instrumentation.rb +2 -2
- 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/version.rb +1 -1
- data/sig/http.rbs +1 -0
- metadata +5 -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
|
|
@@ -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
|
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/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
|
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
|
|
@@ -120,10 +120,10 @@ licenses:
|
|
|
120
120
|
- MIT
|
|
121
121
|
metadata:
|
|
122
122
|
homepage_uri: https://github.com/httprb/http
|
|
123
|
-
source_code_uri: https://github.com/httprb/http/tree/v6.0.
|
|
123
|
+
source_code_uri: https://github.com/httprb/http/tree/v6.0.4
|
|
124
124
|
bug_tracker_uri: https://github.com/httprb/http/issues
|
|
125
|
-
changelog_uri: https://github.com/httprb/http/blob/v6.0.
|
|
126
|
-
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
|
|
127
127
|
rubygems_mfa_required: 'true'
|
|
128
128
|
rdoc_options: []
|
|
129
129
|
require_paths:
|
|
@@ -139,7 +139,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
139
139
|
- !ruby/object:Gem::Version
|
|
140
140
|
version: '0'
|
|
141
141
|
requirements: []
|
|
142
|
-
rubygems_version: 4.0.
|
|
142
|
+
rubygems_version: 4.0.16
|
|
143
143
|
specification_version: 4
|
|
144
144
|
summary: HTTP should be easy
|
|
145
145
|
test_files: []
|