open-uri 0.2.0 → 0.3.0

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: fd3851e3c9717fdf0ab94ecd3e40634536479efa3629bf7a68d8b2e9d500f0b5
4
- data.tar.gz: 7b76252eb3160db3d423e1912b1524c2232d9b583b5c626658c5d441a2c81d6f
3
+ metadata.gz: fdfb473bed054e3c79c78c0e101bc019b4501a85e4cdf2c4feac15f1e288f427
4
+ data.tar.gz: ee7f6ee4dbc4fde6edb7b30c64ae97230b9862b7f26f3e43a22b42315aa33247
5
5
  SHA512:
6
- metadata.gz: 5dda9d882265ec914e6c735497b0b5cc3a40dff5935bd960eb6794526828d0228408b3833748d3c52f97fc71851d3d9c747e038befc07b7a1d80d95c583dceb3
7
- data.tar.gz: e86b98303de2d5224144beeb40a554964ef108682efe99e820a29b647f3531194e506eaead760548ae53e074d13448eaa169480331e700bcdbd0f9d724b27c5e
6
+ metadata.gz: 1a448a39f6fb296628117482836b9b2a64dd7a1f465f87b2c224afda3c78defbbd5424c3c123ac784b8e8ec3dfb03ab43b904d55eff7ec255f4c591d16f2537d
7
+ data.tar.gz: d1f741ea9715d11d0cdc2036ba305134cb689e70911fa868d15ca8edcba29e9e802bf12377886896ab4fecaa3140601fdd4b9b6098dc04b4c0db8c0970b6f827
data/lib/open-uri.rb CHANGED
@@ -9,7 +9,7 @@ module URI
9
9
  # If the first argument responds to the 'open' method, 'open' is called on
10
10
  # it with the rest of the arguments.
11
11
  #
12
- # If the first argument is a string that begins with <code>(protocol)://<code>, it is parsed by
12
+ # If the first argument is a string that begins with <code>(protocol)://</code>, it is parsed by
13
13
  # URI.parse. If the parsed object responds to the 'open' method,
14
14
  # 'open' is called on it with the rest of the arguments.
15
15
  #
@@ -99,6 +99,8 @@ module OpenURI
99
99
  :open_timeout => true,
100
100
  :ssl_ca_cert => nil,
101
101
  :ssl_verify_mode => nil,
102
+ :ssl_min_version => nil,
103
+ :ssl_max_version => nil,
102
104
  :ftp_active_mode => false,
103
105
  :redirect => true,
104
106
  :encoding => nil,
@@ -298,6 +300,8 @@ module OpenURI
298
300
  require 'net/https'
299
301
  http.use_ssl = true
300
302
  http.verify_mode = options[:ssl_verify_mode] || OpenSSL::SSL::VERIFY_PEER
303
+ http.min_version = options[:ssl_min_version]
304
+ http.max_version = options[:ssl_max_version]
301
305
  store = OpenSSL::X509::Store.new
302
306
  if options[:ssl_ca_cert]
303
307
  Array(options[:ssl_ca_cert]).each do |cert|
@@ -353,7 +357,8 @@ module OpenURI
353
357
  when Net::HTTPMovedPermanently, # 301
354
358
  Net::HTTPFound, # 302
355
359
  Net::HTTPSeeOther, # 303
356
- Net::HTTPTemporaryRedirect # 307
360
+ Net::HTTPTemporaryRedirect, # 307
361
+ Net::HTTPPermanentRedirect # 308
357
362
  begin
358
363
  loc_uri = URI.parse(resp['location'])
359
364
  rescue URI::InvalidURIError
@@ -410,6 +415,13 @@ module OpenURI
410
415
  end
411
416
  end
412
417
 
418
+ # :stopdoc:
419
+ RE_LWS = /[\r\n\t ]+/n
420
+ RE_TOKEN = %r{[^\x00- ()<>@,;:\\"/\[\]?={}\x7f]+}n
421
+ RE_QUOTED_STRING = %r{"(?:[\r\n\t !#-\[\]-~\x80-\xff]|\\[\x00-\x7f])*"}n
422
+ RE_PARAMETERS = %r{(?:;#{RE_LWS}?#{RE_TOKEN}#{RE_LWS}?=#{RE_LWS}?(?:#{RE_TOKEN}|#{RE_QUOTED_STRING})#{RE_LWS}?)*}n
423
+ # :startdoc:
424
+
413
425
  # Mixin for holding meta-information.
414
426
  module Meta
415
427
  def Meta.init(obj, src=nil) # :nodoc:
@@ -487,13 +499,6 @@ module OpenURI
487
499
  end
488
500
  end
489
501
 
490
- # :stopdoc:
491
- RE_LWS = /[\r\n\t ]+/n
492
- RE_TOKEN = %r{[^\x00- ()<>@,;:\\"/\[\]?={}\x7f]+}n
493
- RE_QUOTED_STRING = %r{"(?:[\r\n\t !#-\[\]-~\x80-\xff]|\\[\x00-\x7f])*"}n
494
- RE_PARAMETERS = %r{(?:;#{RE_LWS}?#{RE_TOKEN}#{RE_LWS}?=#{RE_LWS}?(?:#{RE_TOKEN}|#{RE_QUOTED_STRING})#{RE_LWS}?)*}n
495
- # :startdoc:
496
-
497
502
  def content_type_parse # :nodoc:
498
503
  vs = @metas['content-type']
499
504
  # The last (?:;#{RE_LWS}?)? matches extra ";" which violates RFC2045.
@@ -698,6 +703,20 @@ module OpenURI
698
703
  #
699
704
  # :ssl_verify_mode is used to specify openssl verify mode.
700
705
  #
706
+ # [:ssl_min_version]
707
+ # Synopsis:
708
+ # :ssl_min_version=>:TLS1_2
709
+ #
710
+ # :ssl_min_version option specifies the minimum allowed SSL/TLS protocol
711
+ # version. See also OpenSSL::SSL::SSLContext#min_version=.
712
+ #
713
+ # [:ssl_max_version]
714
+ # Synopsis:
715
+ # :ssl_max_version=>:TLS1_2
716
+ #
717
+ # :ssl_max_version option specifies the maximum allowed SSL/TLS protocol
718
+ # version. See also OpenSSL::SSL::SSLContext#max_version=.
719
+ #
701
720
  # [:ftp_active_mode]
702
721
  # Synopsis:
703
722
  # :ftp_active_mode=>bool
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: open-uri
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tanaka Akira
8
8
  autorequire:
9
- bindir: exe
9
+ bindir: bin
10
10
  cert_chain: []
11
- date: 2021-10-14 00:00:00.000000000 Z
11
+ date: 2022-12-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: uri
@@ -59,16 +59,9 @@ executables: []
59
59
  extensions: []
60
60
  extra_rdoc_files: []
61
61
  files:
62
- - ".github/workflows/test.yml"
63
- - ".gitignore"
64
- - Gemfile
65
62
  - LICENSE.txt
66
63
  - README.md
67
- - Rakefile
68
- - bin/console
69
- - bin/setup
70
64
  - lib/open-uri.rb
71
- - open-uri.gemspec
72
65
  homepage: https://github.com/ruby/open-uri
73
66
  licenses:
74
67
  - Ruby
@@ -91,7 +84,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
91
84
  - !ruby/object:Gem::Version
92
85
  version: '0'
93
86
  requirements: []
94
- rubygems_version: 3.2.22
87
+ rubygems_version: 3.4.0.dev
95
88
  signing_key:
96
89
  specification_version: 4
97
90
  summary: An easy-to-use wrapper for Net::HTTP, Net::HTTPS and Net::FTP.
@@ -1,22 +0,0 @@
1
- name: test
2
-
3
- on: [push, pull_request]
4
-
5
- jobs:
6
- build:
7
- name: build (${{ matrix.ruby }} / ${{ matrix.os }})
8
- strategy:
9
- matrix:
10
- ruby: [ 2.7, 2.6, 2.5, head ]
11
- os: [ ubuntu-latest, macos-latest ]
12
- runs-on: ${{ matrix.os }}
13
- steps:
14
- - uses: actions/checkout@v2
15
- - name: Set up Ruby
16
- uses: ruby/setup-ruby@v1
17
- with:
18
- ruby-version: ${{ matrix.ruby }}
19
- - name: Install dependencies
20
- run: bundle install
21
- - name: Run test
22
- run: rake test
data/.gitignore DELETED
@@ -1,8 +0,0 @@
1
- /.bundle/
2
- /.yardoc
3
- /_yardoc/
4
- /coverage/
5
- /doc/
6
- /pkg/
7
- /spec/reports/
8
- /tmp/
data/Gemfile DELETED
@@ -1,4 +0,0 @@
1
- source "https://rubygems.org"
2
-
3
- gem "rake"
4
- gem "test-unit"
data/Rakefile DELETED
@@ -1,17 +0,0 @@
1
- require "bundler/gem_tasks"
2
- require "rake/testtask"
3
-
4
- Rake::TestTask.new(:test) do |t|
5
- t.libs << "test/lib"
6
- t.ruby_opts << "-rhelper"
7
- t.test_files = FileList["test/**/test_*.rb"]
8
- end
9
-
10
- task :sync_tool do
11
- require 'fileutils'
12
- FileUtils.cp "../ruby/tool/lib/core_assertions.rb", "./test/lib"
13
- FileUtils.cp "../ruby/tool/lib/envutil.rb", "./test/lib"
14
- FileUtils.cp "../ruby/tool/lib/find_executable.rb", "./test/lib"
15
- end
16
-
17
- task :default => :test
data/bin/console DELETED
@@ -1,14 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- require "bundler/setup"
4
- require "open/uri"
5
-
6
- # You can add fixtures and/or initialization code here to make experimenting
7
- # with your gem easier. You can also use a different console, if you like.
8
-
9
- # (If you use this, don't forget to add pry to your Gemfile!)
10
- # require "pry"
11
- # Pry.start
12
-
13
- require "irb"
14
- IRB.start(__FILE__)
data/bin/setup DELETED
@@ -1,8 +0,0 @@
1
- #!/usr/bin/env bash
2
- set -euo pipefail
3
- IFS=$'\n\t'
4
- set -vx
5
-
6
- bundle install
7
-
8
- # Do any other automated setup that you need to do here
data/open-uri.gemspec DELETED
@@ -1,26 +0,0 @@
1
- Gem::Specification.new do |spec|
2
- spec.name = "open-uri"
3
- spec.version = "0.2.0"
4
- spec.authors = ["Tanaka Akira"]
5
- spec.email = ["akr@fsij.org"]
6
-
7
- spec.summary = %q{An easy-to-use wrapper for Net::HTTP, Net::HTTPS and Net::FTP.}
8
- spec.description = %q{An easy-to-use wrapper for Net::HTTP, Net::HTTPS and Net::FTP.}
9
- spec.homepage = "https://github.com/ruby/open-uri"
10
- spec.required_ruby_version = Gem::Requirement.new(">= 2.3.0")
11
- spec.licenses = ["Ruby", "BSD-2-Clause"]
12
-
13
- spec.metadata["homepage_uri"] = spec.homepage
14
- spec.metadata["source_code_uri"] = spec.homepage
15
-
16
- spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
17
- `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
18
- end
19
- spec.bindir = "exe"
20
- spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
21
- spec.require_paths = ["lib"]
22
-
23
- spec.add_dependency "uri"
24
- spec.add_dependency "stringio"
25
- spec.add_dependency "time"
26
- end