certified-net-http-requests 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +17 -0
- data/Gemfile +4 -0
- data/LICENSE +22 -0
- data/README.md +34 -0
- data/Rakefile +2 -0
- data/bin/update-ca-bundle +6 -0
- data/certified.gemspec +17 -0
- data/lib/certified-net-http-requests.rb +6 -0
- data/lib/certified-net-http-requests/ca-bundle.rb +30 -0
- data/lib/certified-net-http-requests/net-http.rb +12 -0
- data/lib/certified-net-http-requests/version.rb +3 -0
- metadata +60 -0
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2012 Mailo Svetel
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
## Certified net/http requests
|
2
|
+
|
3
|
+
Gem for dealing with `SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed`
|
4
|
+
( http://martinottenwaelter.fr/2010/12/ruby19-and-the-ssl-error/ ) error. This project is highly inspired by
|
5
|
+
[certified](https://github.com/stevegraham/certified) project by Stevie Graham
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
1. Add this line to your application's Gemfile:
|
10
|
+
|
11
|
+
gem 'certified-net-http-requests'
|
12
|
+
|
13
|
+
2. Bundle project:
|
14
|
+
|
15
|
+
$ bundle
|
16
|
+
|
17
|
+
Or install it yourself as:
|
18
|
+
|
19
|
+
$ gem install certified-net-http-requests
|
20
|
+
|
21
|
+
## Usage
|
22
|
+
|
23
|
+
Just require certified-net-http-requests gem in your code
|
24
|
+
|
25
|
+
require 'rubygems'
|
26
|
+
require 'certified-net-http-requests'
|
27
|
+
|
28
|
+
## Contributing
|
29
|
+
|
30
|
+
1. [Fork it](http://help.github.com/fork-a-repo/)
|
31
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
32
|
+
3. Commit your changes (`git commit -am 'Added some feature'`)
|
33
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
34
|
+
5. [Create new Pull Request](http://help.github.com/send-pull-requests/)
|
data/Rakefile
ADDED
data/certified.gemspec
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
require File.expand_path('../lib/certified-net-http-requests/version', __FILE__)
|
3
|
+
|
4
|
+
Gem::Specification.new do |gem|
|
5
|
+
gem.authors = %W("Mailo Svetel")
|
6
|
+
gem.email = %W(mailo@rooland.cz)
|
7
|
+
gem.description = %q{Gem for dealing with `SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed` error}
|
8
|
+
gem.summary = %q{Make net/http verifying ssl certificates against Certificate Authorities from cURL CA bundle }
|
9
|
+
gem.homepage = "http://github.com/roolo/certified-net-http-requests"
|
10
|
+
|
11
|
+
gem.files = `git ls-files`.split($\)
|
12
|
+
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
13
|
+
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
14
|
+
gem.name = "certified-net-http-requests"
|
15
|
+
gem.require_paths = %W(lib)
|
16
|
+
gem.version = Certified::VERSION
|
17
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
module CABundle
|
2
|
+
FILE_PATH = File.expand_path '~/.ca/cacert.pem'
|
3
|
+
|
4
|
+
# Updates local cacert.pem file
|
5
|
+
def self.update
|
6
|
+
require 'net/http'
|
7
|
+
require 'fileutils'
|
8
|
+
|
9
|
+
FileUtils.mkdir File.dirname self::FILE_PATH unless File.directory? File.dirname self::FILE_PATH
|
10
|
+
|
11
|
+
Net::HTTP.start("curl.haxx.se") { |http|
|
12
|
+
resp = http.get("/ca/cacert.pem")
|
13
|
+
open(self::FILE_PATH, "wb") { |file|
|
14
|
+
file.write(resp.body)
|
15
|
+
}
|
16
|
+
}
|
17
|
+
end
|
18
|
+
|
19
|
+
def self.get_path current_path = nil
|
20
|
+
if File.exists? self::FILE_PATH
|
21
|
+
Kernel.warn "Object already has #{current_path} as CA File path" if current_path
|
22
|
+
self::FILE_PATH
|
23
|
+
else
|
24
|
+
Kernel.warn <<-WARN
|
25
|
+
#{self::FILE_PATH} does not exists. Please run `update-ca-bundle` command or download it manually from
|
26
|
+
http://curl.haxx.se/docs/caextract.html
|
27
|
+
WARN
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
metadata
ADDED
@@ -0,0 +1,60 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: certified-net-http-requests
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- ! '"Mailo'
|
9
|
+
- Svetel"
|
10
|
+
autorequire:
|
11
|
+
bindir: bin
|
12
|
+
cert_chain: []
|
13
|
+
date: 2012-03-21 00:00:00.000000000Z
|
14
|
+
dependencies: []
|
15
|
+
description: ! 'Gem for dealing with `SSL_connect returned=1 errno=0 state=SSLv3 read
|
16
|
+
server certificate B: certificate verify failed` error'
|
17
|
+
email:
|
18
|
+
- mailo@rooland.cz
|
19
|
+
executables:
|
20
|
+
- update-ca-bundle
|
21
|
+
extensions: []
|
22
|
+
extra_rdoc_files: []
|
23
|
+
files:
|
24
|
+
- .gitignore
|
25
|
+
- Gemfile
|
26
|
+
- LICENSE
|
27
|
+
- README.md
|
28
|
+
- Rakefile
|
29
|
+
- bin/update-ca-bundle
|
30
|
+
- certified.gemspec
|
31
|
+
- lib/certified-net-http-requests.rb
|
32
|
+
- lib/certified-net-http-requests/ca-bundle.rb
|
33
|
+
- lib/certified-net-http-requests/net-http.rb
|
34
|
+
- lib/certified-net-http-requests/version.rb
|
35
|
+
homepage: http://github.com/roolo/certified-net-http-requests
|
36
|
+
licenses: []
|
37
|
+
post_install_message:
|
38
|
+
rdoc_options: []
|
39
|
+
require_paths:
|
40
|
+
- lib
|
41
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
42
|
+
none: false
|
43
|
+
requirements:
|
44
|
+
- - ! '>='
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: '0'
|
47
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
48
|
+
none: false
|
49
|
+
requirements:
|
50
|
+
- - ! '>='
|
51
|
+
- !ruby/object:Gem::Version
|
52
|
+
version: '0'
|
53
|
+
requirements: []
|
54
|
+
rubyforge_project:
|
55
|
+
rubygems_version: 1.8.19
|
56
|
+
signing_key:
|
57
|
+
specification_version: 3
|
58
|
+
summary: Make net/http verifying ssl certificates against Certificate Authorities
|
59
|
+
from cURL CA bundle
|
60
|
+
test_files: []
|