[Groonga-commit] ranguba/groonga-client at 04f00f2 [master] http: support more TLS options

Back to archive index

Kouhei Sutou null+****@clear*****
Sun Mar 13 22:37:49 JST 2016


Kouhei Sutou	2016-03-13 22:37:49 +0900 (Sun, 13 Mar 2016)

  New Revision: 04f00f2a24e898506536d6c45f608976aadd7b31
  https://github.com/ranguba/groonga-client/commit/04f00f2a24e898506536d6c45f608976aadd7b31

  Message:
    http: support more TLS options
    
    They aren't tested. :<

  Modified files:
    lib/groonga/client/protocol/http/synchronous.rb

  Modified: lib/groonga/client/protocol/http/synchronous.rb (+18 -4)
===================================================================
--- lib/groonga/client/protocol/http/synchronous.rb    2016-03-13 22:06:13 +0900 (211650c)
+++ lib/groonga/client/protocol/http/synchronous.rb    2016-03-13 22:37:49 +0900 (b04a1bb)
@@ -33,10 +33,7 @@ module Groonga
 
           def send(command)
             begin
-              options = {
-                :use_ssl => @url.scheme == "https"
-              }
-              Net::HTTP.start(@url.host, @url.port, options) do |http|
+              Net::HTTP.start(@url.host, @url.port, start_options) do |http|
                 http.read_timeout = read_timeout
                 response = send_request(http, command)
                 case response
@@ -92,6 +89,23 @@ module Groonga
           end
 
           private
+          def start_options
+            tls_options = @options[:tls] || {}
+            case tls_options[:verify_mode]
+            when :none
+              tls_options[:verify_mode] = OpenSSL::SSL::VERIFY_NONE
+            when :peer
+              tls_options[:verify_mode] = OpenSSL::SSL::VERIFY_PEER
+            end
+
+            {
+              :use_ssl => @url.scheme == "https",
+              :ca_file => tls_options[:ca_file],
+              :ca_path => tls_options[:ca_path],
+              :verify_mode => tls_options[:verify_mode],
+            }
+          end
+
           def read_timeout
             timeout = @options[:read_timeout]
             if timeout < 0
-------------- next part --------------
HTML����������������������������...
下载 



More information about the Groonga-commit mailing list
Back to archive index