httpi 3.0.1 → 3.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c3e533863eed443ec1b23c42cf9959c3312c8ddff5a1b45102028263325ad473
4
- data.tar.gz: 5ea0350ab1711603f712d0ae02ea6e14f3f89b225866585b5aff8833c855d60c
3
+ metadata.gz: cd06f829b3d33418dfe3ef465949f504f6acde0e9f5988edea9615e700bb8f23
4
+ data.tar.gz: '00197cf31c50d34768c76325d42cc8dc325774ffe5a2ecaf6feb33f7d22c382c'
5
5
  SHA512:
6
- metadata.gz: 3d53e35db56687d59d42e7b7e2b609c00ec3f5d241a77189bcbd780c87d6596466a0e709d300ed66956e67634f228c94dff675bd60ec13b6c5a4d1422f5253d1
7
- data.tar.gz: 29fa0caf340530e89c435c1730387d255301ad6a06395b8860c1642c272150c91ce0f5c7c128a5500aecf0ba5484fbeaed384600f60ce48a530dd51b76e8b690
6
+ metadata.gz: 81a2a86d8a7784711c0a72995a21262c7bcdfb17d9127a06a9573c50f7eaffde7e544c07b332e905da3fb1b177d867d34c2b59a75f0605182a6d278db9eda4a6
7
+ data.tar.gz: e59a0468efe743db6a4b4d7eff007714cb739e928396b7ff8797896a346e7808a2635185ccf1a9eb53db64d149626782a4f3dc530f3e9644c21923ce6a4a0f3d
@@ -0,0 +1,22 @@
1
+ // For format details, see https://aka.ms/devcontainer.json. For config options, see the
2
+ // README at: https://github.com/devcontainers/templates/tree/main/src/ruby
3
+ {
4
+ "name": "Ruby",
5
+ // Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
6
+ "image": "mcr.microsoft.com/devcontainers/ruby:1-3.2-bullseye"
7
+
8
+ // Features to add to the dev container. More info: https://containers.dev/features.
9
+ // "features": {},
10
+
11
+ // Use 'forwardPorts' to make a list of ports inside the container available locally.
12
+ // "forwardPorts": [],
13
+
14
+ // Use 'postCreateCommand' to run commands after the container is created.
15
+ // "postCreateCommand": "ruby --version",
16
+
17
+ // Configure tool-specific properties.
18
+ // "customizations": {},
19
+
20
+ // Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
21
+ // "remoteUser": "root"
22
+ }
@@ -14,9 +14,10 @@ jobs:
14
14
  - ubuntu
15
15
 
16
16
  ruby:
17
- - "2.6"
18
- - "2.7"
19
17
  - "3.0"
18
+ - "3.1"
19
+ - "3.2"
20
+ - "3.3"
20
21
 
21
22
  experimental: [false]
22
23
  env: [""]
@@ -33,7 +34,7 @@ jobs:
33
34
  experimental: true
34
35
 
35
36
  steps:
36
- - uses: actions/checkout@v2
37
+ - uses: actions/checkout@v3
37
38
 
38
39
  - name: Install dependencies
39
40
  run: sudo apt-get install libcurl4-openssl-dev
data/CHANGELOG.md CHANGED
@@ -1,3 +1,11 @@
1
+ ### Unreleased
2
+
3
+ * Improvement: [#237](https://github.com/savonrb/httpi/pull/237) Implemented `adapter_client_setup`.
4
+
5
+ ### 3.0.2 (2024-02-10)
6
+
7
+ * Add support for ruby 3.1, 3.2, 3.3. Drop support for ruby 2.7 and below.
8
+
1
9
  ### 3.0.1 (2021-12-17)
2
10
 
3
11
  * Fix: [#230](https://github.com/savonrb/httpi/pull/230) Make rack a runtime dependency.
data/Gemfile CHANGED
@@ -10,12 +10,12 @@ gem 'httpclient', '~> 2.3', :require => false
10
10
  gem 'curb', '~> 0.8', :require => false, :platforms => [:ruby]
11
11
  gem 'em-http-request', :require => false, :platforms => [:ruby]
12
12
  gem 'em-synchrony', :require => false, :platforms => [:ruby, :jruby]
13
- gem 'excon', '~> 0.21', :require => false, :platforms => [:ruby, :jruby]
13
+ gem 'excon', '~> 0.71', :require => false, :platforms => [:ruby, :jruby]
14
14
  gem 'net-http-persistent', '~> 4.0', :require => false
15
15
  gem 'http', :require => false
16
16
 
17
17
  # adapter extensions
18
- gem 'rack'
18
+ gem 'rack', '< 3'
19
19
  gem 'socksify'
20
20
 
21
21
  # coverage
data/httpi.gemspec CHANGED
@@ -8,15 +8,23 @@ Gem::Specification.new do |s|
8
8
  s.version = HTTPI::VERSION
9
9
  s.authors = ['Daniel Harrington', 'Martin Tepper']
10
10
  s.email = 'me@rubiii.com'
11
- s.homepage = "http://github.com/savonrb/#{s.name}"
11
+ s.homepage = "https://github.com/savonrb/httpi"
12
12
  s.summary = "Common interface for Ruby's HTTP libraries"
13
13
  s.description = s.summary
14
+ s.metadata = { 'bug_tracker_uri' => 'https://github.com/savonrb/httpi/issues',
15
+ 'changelog_uri' => 'https://github.com/savonrb/httpi/blob/master/CHANGELOG.md',
16
+ 'source_code_uri' => s.homepage,
17
+ 'wiki_uri' => 'https://github.com/savonrb/httpi/wiki',
18
+ 'documentation_uri' => 'https://www.rubydoc.info/gems/httpi' }
14
19
 
15
- s.required_ruby_version = '>= 2.3'
20
+ s.required_ruby_version = '>= 3.0'
16
21
 
17
22
  s.license = 'MIT'
18
23
 
19
- s.add_dependency 'rack'
24
+ s.add_dependency 'rack', '< 3'
25
+ s.add_dependency 'nkf'
26
+ s.add_dependency 'base64'
27
+ s.add_dependency 'mutex_m'
20
28
 
21
29
  s.add_development_dependency 'rubyntlm', '~> 0.3.2'
22
30
  s.add_development_dependency 'rake', '~> 13.0'
@@ -25,6 +33,8 @@ Gem::Specification.new do |s|
25
33
  s.add_development_dependency 'puma', '~> 5.0'
26
34
  s.add_development_dependency 'webmock'
27
35
 
36
+ s.metadata["rubygems_mfa_required"] = "true"
37
+
28
38
  s.files = `git ls-files`.split("\n")
29
39
  s.require_path = 'lib'
30
40
  end
data/lib/httpi/adapter.rb CHANGED
@@ -34,6 +34,8 @@ module HTTPI
34
34
  @adapter ||= default_adapter
35
35
  end
36
36
 
37
+ attr_accessor :client_setup_block
38
+
37
39
  def identify(adapter_class)
38
40
  ADAPTER_CLASS_MAP[adapter_class]
39
41
  end
data/lib/httpi/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module HTTPI
2
- VERSION = '3.0.1'
2
+ VERSION = '3.0.2'
3
3
  end
data/lib/httpi.rb CHANGED
@@ -154,7 +154,8 @@ module HTTPI
154
154
  # Executes an HTTP request for the given +method+.
155
155
  def request(method, request, adapter = nil, redirects = 0)
156
156
  adapter_class = load_adapter(adapter, request)
157
-
157
+
158
+ Adapter.client_setup_block.call(adapter_class.client) if Adapter.client_setup_block
158
159
  yield adapter_class.client if block_given?
159
160
  log_request(method, request, Adapter.identify(adapter_class.class))
160
161
 
@@ -174,6 +175,10 @@ module HTTPI
174
175
  Adapter.use = adapter
175
176
  end
176
177
 
178
+ def adapter_client_setup=(block)
179
+ Adapter.client_setup_block = block
180
+ end
181
+
177
182
  private
178
183
 
179
184
  def request_and_adapter_from(args)
@@ -215,7 +215,8 @@ describe HTTPI::Adapter::HTTPClient do
215
215
  end
216
216
  end
217
217
 
218
- it "supports NTLM authentication" do
218
+ # TODO: ntlm_openssl3 https://github.com/WinRb/rubyntlm/issues/57
219
+ xit "supports NTLM authentication" do
219
220
  request = HTTPI::Request.new(@server.url + "ntlm-auth")
220
221
 
221
222
  request.auth.ntlm("tester", "vReqSoafRe5O")
@@ -33,6 +33,18 @@ describe HTTPI do
33
33
  end
34
34
  end
35
35
 
36
+ describe ".adapter_client_setup=" do
37
+ after do
38
+ HTTPI.adapter_client_setup = nil
39
+ end
40
+
41
+ it "sets the adapter client setup block" do
42
+ block = proc { }
43
+ HTTPI.adapter_client_setup = block
44
+ expect(HTTPI::Adapter.client_setup_block).to eq(block)
45
+ end
46
+ end
47
+
36
48
  describe ".query_builder" do
37
49
  it "gets flat builder by default" do
38
50
  expect(client.query_builder).to eq(HTTPI::QueryBuilder::Flat)
@@ -281,6 +293,18 @@ describe HTTPI do
281
293
 
282
294
  client.request(:custom, request, :httpclient)
283
295
  end
296
+
297
+ describe "client setup block present" do
298
+ around do |example|
299
+ HTTPI::Adapter.client_setup_block = proc { |client| client.base_url = 'https://google.com' }
300
+ example.run
301
+ HTTPI::Adapter.client_setup_block = nil
302
+ end
303
+
304
+ it 'calls client setup block' do
305
+ client.request(:get, request, :httpclient) { |client| expect(client.base_url).to eq('https://google.com') }
306
+ end
307
+ end
284
308
  end
285
309
 
286
310
  HTTPI::REQUEST_METHODS.each do |method|
@@ -138,7 +138,8 @@ describe HTTPI::Adapter::NetHTTP do
138
138
  to raise_error(HTTPI::NotSupportedError, /does not support HTTP digest authentication/)
139
139
  end
140
140
 
141
- it "supports ntlm authentication" do
141
+ # TODO: ntlm_openssl3 https://github.com/WinRb/rubyntlm/issues/57
142
+ xit "supports ntlm authentication" do
142
143
  request = HTTPI::Request.new(@server.url + "ntlm-auth")
143
144
  request.auth.ntlm("tester", "vReqSoafRe5O")
144
145
 
@@ -166,7 +167,8 @@ describe HTTPI::Adapter::NetHTTP do
166
167
  HTTPI::Adapter::NetHTTP.any_instance.unstub(:check_net_ntlm_version!)
167
168
  end
168
169
 
169
- it "does check ntlm when ntlm authentication is requested" do
170
+ # TODO: ntlm_openssl3 https://github.com/WinRb/rubyntlm/issues/57
171
+ xit "does check ntlm when ntlm authentication is requested" do
170
172
  request = HTTPI::Request.new(@server.url + "ntlm-auth")
171
173
  request.auth.ntlm("tester", "vReqSoafRe5O")
172
174
 
@@ -183,7 +185,8 @@ describe HTTPI::Adapter::NetHTTP do
183
185
  HTTPI::Adapter::NetHTTP.any_instance.unstub(:ntlm_version)
184
186
  end
185
187
 
186
- it "does not crash when authenticate header is missing (on second request)" do
188
+ # TODO: ntlm_openssl3 https://github.com/WinRb/rubyntlm/issues/57
189
+ xit "does not crash when authenticate header is missing (on second request)" do
187
190
  request = HTTPI::Request.new(@server.url + "ntlm-auth")
188
191
  request.auth.ntlm("tester", "vReqSoafRe5O")
189
192
 
metadata CHANGED
@@ -1,18 +1,60 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: httpi
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.1
4
+ version: 3.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Harrington
8
8
  - Martin Tepper
9
- autorequire:
9
+ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2021-12-17 00:00:00.000000000 Z
12
+ date: 2024-02-11 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rack
16
+ requirement: !ruby/object:Gem::Requirement
17
+ requirements:
18
+ - - "<"
19
+ - !ruby/object:Gem::Version
20
+ version: '3'
21
+ type: :runtime
22
+ prerelease: false
23
+ version_requirements: !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - "<"
26
+ - !ruby/object:Gem::Version
27
+ version: '3'
28
+ - !ruby/object:Gem::Dependency
29
+ name: nkf
30
+ requirement: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - ">="
33
+ - !ruby/object:Gem::Version
34
+ version: '0'
35
+ type: :runtime
36
+ prerelease: false
37
+ version_requirements: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - ">="
40
+ - !ruby/object:Gem::Version
41
+ version: '0'
42
+ - !ruby/object:Gem::Dependency
43
+ name: base64
44
+ requirement: !ruby/object:Gem::Requirement
45
+ requirements:
46
+ - - ">="
47
+ - !ruby/object:Gem::Version
48
+ version: '0'
49
+ type: :runtime
50
+ prerelease: false
51
+ version_requirements: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - ">="
54
+ - !ruby/object:Gem::Version
55
+ version: '0'
56
+ - !ruby/object:Gem::Dependency
57
+ name: mutex_m
16
58
  requirement: !ruby/object:Gem::Requirement
17
59
  requirements:
18
60
  - - ">="
@@ -115,6 +157,7 @@ executables: []
115
157
  extensions: []
116
158
  extra_rdoc_files: []
117
159
  files:
160
+ - ".devcontainer/devcontainer.json"
118
161
  - ".github/workflows/development.yml"
119
162
  - ".gitignore"
120
163
  - ".rspec"
@@ -187,11 +230,17 @@ files:
187
230
  - spec/support/error_helper.rb
188
231
  - spec/support/fixture.rb
189
232
  - spec/support/matchers.rb
190
- homepage: http://github.com/savonrb/httpi
233
+ homepage: https://github.com/savonrb/httpi
191
234
  licenses:
192
235
  - MIT
193
- metadata: {}
194
- post_install_message:
236
+ metadata:
237
+ bug_tracker_uri: https://github.com/savonrb/httpi/issues
238
+ changelog_uri: https://github.com/savonrb/httpi/blob/master/CHANGELOG.md
239
+ source_code_uri: https://github.com/savonrb/httpi
240
+ wiki_uri: https://github.com/savonrb/httpi/wiki
241
+ documentation_uri: https://www.rubydoc.info/gems/httpi
242
+ rubygems_mfa_required: 'true'
243
+ post_install_message:
195
244
  rdoc_options: []
196
245
  require_paths:
197
246
  - lib
@@ -199,15 +248,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
199
248
  requirements:
200
249
  - - ">="
201
250
  - !ruby/object:Gem::Version
202
- version: '2.3'
251
+ version: '3.0'
203
252
  required_rubygems_version: !ruby/object:Gem::Requirement
204
253
  requirements:
205
254
  - - ">="
206
255
  - !ruby/object:Gem::Version
207
256
  version: '0'
208
257
  requirements: []
209
- rubygems_version: 3.2.7
210
- signing_key:
258
+ rubygems_version: 3.4.10
259
+ signing_key:
211
260
  specification_version: 4
212
261
  summary: Common interface for Ruby's HTTP libraries
213
262
  test_files: []