rubysl-net-http 1.0.1 → 2.0.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,6 +1,11 @@
1
1
  =begin
2
2
 
3
- = $RCSfile$ -- SSL/TLS enhancement for Net::HTTP.
3
+ = net/https -- SSL/TLS enhancement for Net::HTTP.
4
+
5
+ This file has been merged with net/http. There is no longer any need to
6
+ require 'net/https' to use HTTPS.
7
+
8
+ See Net::HTTP for details on how to make HTTPS connections.
4
9
 
5
10
  == Info
6
11
  'OpenSSL for Ruby 2' project
@@ -11,163 +16,7 @@
11
16
  This program is licenced under the same licence as Ruby.
12
17
  (See the file 'LICENCE'.)
13
18
 
14
- == Requirements
15
- This program requires Net 1.2.0 or higher version.
16
- You can get it from RAA or Ruby's CVS repository.
17
-
18
- == Version
19
- $Id$
20
-
21
- 2001-11-06: Contiributed to Ruby/OpenSSL project.
22
- 2004-03-06: Some code is merged in to net/http.
23
-
24
- == Example
25
-
26
- Here is a simple HTTP client:
27
-
28
- require 'net/http'
29
- require 'uri'
30
-
31
- uri = URI.parse(ARGV[0] || 'http://localhost/')
32
- http = Net::HTTP.new(uri.host, uri.port)
33
- http.start {
34
- http.request_get(uri.path) {|res|
35
- print res.body
36
- }
37
- }
38
-
39
- It can be replaced by the following code:
40
-
41
- require 'net/https'
42
- require 'uri'
43
-
44
- uri = URI.parse(ARGV[0] || 'https://localhost/')
45
- http = Net::HTTP.new(uri.host, uri.port)
46
- http.use_ssl = true if uri.scheme == "https" # enable SSL/TLS
47
- http.start {
48
- http.request_get(uri.path) {|res|
49
- print res.body
50
- }
51
- }
52
-
53
- == class Net::HTTP
54
-
55
- === Instance Methods
56
-
57
- : use_ssl?
58
- returns true if use SSL/TLS with HTTP.
59
-
60
- : use_ssl=((|true_or_false|))
61
- sets use_ssl.
62
-
63
- : peer_cert
64
- return the X.509 certificates the server presented.
65
-
66
- : key, key=((|key|))
67
- Sets an OpenSSL::PKey::RSA or OpenSSL::PKey::DSA object.
68
- (This method is appeared in Michal Rokos's OpenSSL extension.)
69
-
70
- : cert, cert=((|cert|))
71
- Sets an OpenSSL::X509::Certificate object as client certificate
72
- (This method is appeared in Michal Rokos's OpenSSL extension).
73
-
74
- : ca_file, ca_file=((|path|))
75
- Sets path of a CA certification file in PEM format.
76
- The file can contrain several CA certificats.
77
-
78
- : ca_path, ca_path=((|path|))
79
- Sets path of a CA certification directory containing certifications
80
- in PEM format.
81
-
82
- : verify_mode, verify_mode=((|mode|))
83
- Sets the flags for server the certification verification at
84
- begining of SSL/TLS session.
85
- OpenSSL::SSL::VERIFY_NONE or OpenSSL::SSL::VERIFY_PEER is acceptable.
86
-
87
- : verify_callback, verify_callback=((|proc|))
88
- Sets the verify callback for the server certification verification.
89
-
90
- : verify_depth, verify_depth=((|num|))
91
- Sets the maximum depth for the certificate chain verification.
92
-
93
- : cert_store, cert_store=((|store|))
94
- Sets the X509::Store to verify peer certificate.
95
-
96
- : ssl_timeout, ssl_timeout=((|sec|))
97
- Sets the SSL timeout seconds.
98
-
99
19
  =end
100
20
 
101
21
  require 'net/http'
102
22
  require 'openssl'
103
-
104
- module Net
105
-
106
- class HTTP
107
- remove_method :use_ssl?
108
- def use_ssl?
109
- @use_ssl
110
- end
111
-
112
- # For backward compatibility.
113
- alias use_ssl use_ssl?
114
-
115
- # Turn on/off SSL.
116
- # This flag must be set before starting session.
117
- # If you change use_ssl value after session started,
118
- # a Net::HTTP object raises IOError.
119
- def use_ssl=(flag)
120
- flag = (flag ? true : false)
121
- raise IOError, "use_ssl value changed, but session already started" \
122
- if started? and @use_ssl != flag
123
- if flag and not @ssl_context
124
- @ssl_context = OpenSSL::SSL::SSLContext.new
125
- end
126
- @use_ssl = flag
127
- end
128
-
129
- def self.ssl_context_accessor(name)
130
- module_eval(<<-End, __FILE__, __LINE__ + 1)
131
- def #{name}
132
- return nil unless @ssl_context
133
- @ssl_context.#{name}
134
- end
135
-
136
- def #{name}=(val)
137
- @ssl_context ||= OpenSSL::SSL::SSLContext.new
138
- @ssl_context.#{name} = val
139
- end
140
- End
141
- end
142
-
143
- ssl_context_accessor :key
144
- ssl_context_accessor :cert
145
- ssl_context_accessor :ca_file
146
- ssl_context_accessor :ca_path
147
- ssl_context_accessor :verify_mode
148
- ssl_context_accessor :verify_callback
149
- ssl_context_accessor :verify_depth
150
- ssl_context_accessor :cert_store
151
-
152
- def ssl_timeout
153
- return nil unless @ssl_context
154
- @ssl_context.timeout
155
- end
156
-
157
- def ssl_timeout=(sec)
158
- raise ArgumentError, 'Net::HTTP#ssl_timeout= called but use_ssl=false' \
159
- unless use_ssl?
160
- @ssl_context ||= OpenSSL::SSL::SSLContext.new
161
- @ssl_context.timeout = sec
162
- end
163
-
164
- # For backward compatibility
165
- alias timeout= ssl_timeout=
166
-
167
- def peer_cert
168
- return nil if not use_ssl? or not @socket
169
- @socket.io.peer_cert
170
- end
171
- end
172
-
173
- end
@@ -1,7 +1,7 @@
1
1
  module RubySL
2
2
  module Net
3
3
  module HTTP
4
- VERSION = "1.0.1"
4
+ VERSION = "2.0.4"
5
5
  end
6
6
  end
7
7
  end
@@ -16,15 +16,15 @@ Gem::Specification.new do |spec|
16
16
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
17
17
  spec.require_paths = ["lib"]
18
18
 
19
- spec.required_ruby_version = "~> 1.8.7"
19
+ spec.required_ruby_version = "~> 2.0"
20
20
 
21
- spec.add_runtime_dependency "rubysl-cgi", "~> 1.0"
22
- spec.add_runtime_dependency "rubysl-erb", "~> 1.0"
23
- spec.add_runtime_dependency "rubysl-singleton", "~> 1.0"
21
+ spec.add_runtime_dependency "rubysl-cgi", "~> 2.0"
22
+ spec.add_runtime_dependency "rubysl-erb", "~> 2.0"
23
+ spec.add_runtime_dependency "rubysl-singleton", "~> 2.0"
24
24
 
25
25
  spec.add_development_dependency "bundler", "~> 1.3"
26
26
  spec.add_development_dependency "rake", "~> 10.0"
27
27
  spec.add_development_dependency "mspec", "~> 1.5"
28
- spec.add_development_dependency "rubysl-webrick", "~> 1.0"
29
- spec.add_development_dependency "rubysl-prettyprint", "~> 1.0"
28
+ spec.add_development_dependency "rubysl-webrick", "~> 2.0"
29
+ spec.add_development_dependency "rubysl-prettyprint", "~> 2.0"
30
30
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubysl-net-http
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 2.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brian Shirai
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-06-16 00:00:00.000000000 Z
11
+ date: 2013-09-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rubysl-cgi
@@ -16,42 +16,42 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '1.0'
19
+ version: '2.0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '1.0'
26
+ version: '2.0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rubysl-erb
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '1.0'
33
+ version: '2.0'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '1.0'
40
+ version: '2.0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rubysl-singleton
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '1.0'
47
+ version: '2.0'
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: '1.0'
54
+ version: '2.0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: bundler
57
57
  requirement: !ruby/object:Gem::Requirement
@@ -100,28 +100,28 @@ dependencies:
100
100
  requirements:
101
101
  - - "~>"
102
102
  - !ruby/object:Gem::Version
103
- version: '1.0'
103
+ version: '2.0'
104
104
  type: :development
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
108
  - - "~>"
109
109
  - !ruby/object:Gem::Version
110
- version: '1.0'
110
+ version: '2.0'
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: rubysl-prettyprint
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
115
  - - "~>"
116
116
  - !ruby/object:Gem::Version
117
- version: '1.0'
117
+ version: '2.0'
118
118
  type: :development
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
122
  - - "~>"
123
123
  - !ruby/object:Gem::Version
124
- version: '1.0'
124
+ version: '2.0'
125
125
  description: Ruby standard library net-http.
126
126
  email:
127
127
  - brixen@gmail.com
@@ -136,6 +136,15 @@ files:
136
136
  - README.md
137
137
  - Rakefile
138
138
  - lib/net/http.rb
139
+ - lib/net/http/backward.rb
140
+ - lib/net/http/exceptions.rb
141
+ - lib/net/http/generic_request.rb
142
+ - lib/net/http/header.rb
143
+ - lib/net/http/proxy_delta.rb
144
+ - lib/net/http/request.rb
145
+ - lib/net/http/requests.rb
146
+ - lib/net/http/response.rb
147
+ - lib/net/http/responses.rb
139
148
  - lib/net/https.rb
140
149
  - lib/rubysl/net/http.rb
141
150
  - lib/rubysl/net/http/http.rb
@@ -303,7 +312,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
303
312
  requirements:
304
313
  - - "~>"
305
314
  - !ruby/object:Gem::Version
306
- version: 1.8.7
315
+ version: '2.0'
307
316
  required_rubygems_version: !ruby/object:Gem::Requirement
308
317
  requirements:
309
318
  - - ">="
@@ -311,7 +320,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
311
320
  version: '0'
312
321
  requirements: []
313
322
  rubyforge_project:
314
- rubygems_version: 2.2.2
323
+ rubygems_version: 2.0.7
315
324
  signing_key:
316
325
  specification_version: 4
317
326
  summary: Ruby standard library net-http.
@@ -465,3 +474,4 @@ test_files:
465
474
  - spec/httpresponse/shared/body.rb
466
475
  - spec/httpresponse/to_ary_spec.rb
467
476
  - spec/httpresponse/value_spec.rb
477
+ has_rdoc: