Copilot commented on code in PR #3634:
URL: https://github.com/apache/thrift/pull/3634#discussion_r3566716541


##########
test/rb/integration/TestClient.rb:
##########
@@ -63,77 +63,92 @@
 
 class SimpleClientTest < Test::Unit::TestCase
   def setup
-    unless @socket
-      if $domain_socket.to_s.strip.empty?
+    unless @transport
+      if $transport == "http"
+        if !$domain_socket.to_s.strip.empty?
+          raise 'transport http is not valid with --domain-socket'
+        end
+
+        scheme = $ssl ? 'https' : 'http'
+        options = {}
         if $ssl
-          # the working directory for ruby crosstest is test/rb/gen-rb
-          keysDir = File.join(File.dirname(File.dirname(Dir.pwd)), "keys")
-          ctx = OpenSSL::SSL::SSLContext.new
-          ctx.ca_file = File.join(keysDir, "CA.pem")
-          ctx.cert = 
OpenSSL::X509::Certificate.new(File.open(File.join(keysDir, "client.crt")))
-          ctx.cert_store = OpenSSL::X509::Store.new
-          ctx.cert_store.add_file(File.join(keysDir, 'server.pem'))
-          ctx.key = OpenSSL::PKey::RSA.new(File.open(File.join(keysDir, 
"client.key")))
-          ctx.options = OpenSSL::SSL::OP_NO_SSLv2 | OpenSSL::SSL::OP_NO_SSLv3
-          ctx.ssl_version = :SSLv23
-          ctx.verify_mode = OpenSSL::SSL::VERIFY_PEER
-          @socket = Thrift::SSLSocket.new($host, $port, nil, ctx)
-        else
-          @socket = Thrift::Socket.new($host, $port)
+          keys_dir = File.join(File.dirname(File.dirname(Dir.pwd)), 'keys')
+          options[:ssl_ca_file] = File.join(keys_dir, 'CA.pem')
         end
+        @transport = 
Thrift::HTTPClientTransport.new("#{scheme}://#{$host}:#{$port}/test", options)

Review Comment:
   Ruby HTTP client hard-codes the request path to `/test`, but at least the Go 
HTTP cross-test server only registers its Thrift handler on `/` (see 
test/go/src/bin/testserver/main.go:50-52). This will cause rb-as-client HTTP 
runs against the Go server to receive 404s.
   
   Use `/` here (or make the path configurable in the harness) so the Ruby 
client can interoperate with the existing HTTP test servers.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to