We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent eea968f commit 7d8a059Copy full SHA for 7d8a059
README.md
@@ -26,4 +26,23 @@ To reference the installed CA Bundle, you can use the built-in function:
26
> Certifi.where
27
=> #<Pathname:/home/hone/.gems/ruby/2.1.0/ruby-certifi-14.5.14/lib/certifi/vendor/cacert.pem>
28
29
+You can use this with `net/http` to verify the SSL certificate:
30
+
31
+```ruby
32
+require 'uri'
33
+require 'net/https'
34
+require 'certifi'
35
36
+uri = URI.parse('https://httpbin.org/')
37
+http = Net::HTTP.new(uri.host, uri.port)
38
+http.use_ssl = true
39
+http.verify_mode = OpenSSL::SSL::VERIFY_PEER
40
+http.ca_file = Certifi.where
41
+http.start do
42
+ http.request_get(uri.path) do |res|
43
+ puts res.body
44
+ end
45
+end
46
+```
47
48
Enjoy!
0 commit comments