{"action":"created","comment":{"url":"https://api.github.com/repos/rethinkdb/rethinkdb/pulls/comments/28641231","id":28641231,"diff_hunk":"@@ -647,6 +649,44 @@ def connect()\n       self\n     end\n \n+    def init_socket\n+      unless @ssl_opts.empty?\n+        @tcp_socket = base_socket\n+        @tcp_socket.connect(::Socket.pack_sockaddr_in(@port, @host))\n+        context = create_context(@ssl_opts)\n+        @socket = OpenSSL::SSL::SSLSocket.new(@tcp_socket, context)\n+        @socket.sync_close = true\n+        @socket.connect\n+        verify_cert!(@socket, context)\n+      else\n+        @socket = base_socket\n+        @socket.connect(Socket.pack_sockaddr_in(@port, @host))\n+      end\n+    end\n+\n+    def base_socket\n+      socket = Socket.new(Socket::PF_INET, Socket::SOCK_STREAM, 0)","path":"drivers/ruby/lib/net.rb","position":54,"original_position":54,"commit_id":"929ed8153294698493313437d1c2a700998d7017","original_commit_id":"929ed8153294698493313437d1c2a700998d7017","user":{"login":"mlucy","id":1777134,"avatar_url":"https://avatars.githubusercontent.com/u/1777134?v=3","gravatar_id":"","url":"https://api.github.com/users/mlucy","html_url":"https://github.com/mlucy","followers_url":"https://api.github.com/users/mlucy/followers","following_url":"https://api.github.com/users/mlucy/following{/other_user}","gists_url":"https://api.github.com/users/mlucy/gists{/gist_id}","starred_url":"https://api.github.com/users/mlucy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mlucy/subscriptions","organizations_url":"https://api.github.com/users/mlucy/orgs","repos_url":"https://api.github.com/users/mlucy/repos","events_url":"https://api.github.com/users/mlucy/events{/privacy}","received_events_url":"https://api.github.com/users/mlucy/received_events","type":"User","site_admin":false},"body":"Are there any cases where this followed by `.connect` behaves differently than `TCPSocket.open`?","created_at":"2015-04-18T04:23:49Z","updated_at":"2015-04-18T04:23:49Z","html_url":"https://github.com/rethinkdb/rethinkdb/pull/4075#discussion_r28641231","pull_request_url":"https://api.github.com/repos/rethinkdb/rethinkdb/pulls/4075","_links":{"self":{"href":"https://api.github.com/repos/rethinkdb/rethinkdb/pulls/comments/28641231"},"html":{"href":"https://github.com/rethinkdb/rethinkdb/pull/4075#discussion_r28641231"},"pull_request":{"href":"https://api.github.com/repos/rethinkdb/rethinkdb/pulls/4075"}}},"pull_request":{"url":"https://api.github.com/repos/rethinkdb/rethinkdb/pulls/4075","id":33561276,"html_url":"https://github.com/rethinkdb/rethinkdb/pull/4075","diff_url":"https://github.com/rethinkdb/rethinkdb/pull/4075.diff","patch_url":"https://github.com/rethinkdb/rethinkdb/pull/4075.patch","issue_url":"https://api.github.com/repos/rethinkdb/rethinkdb/issues/4075","number":4075,"state":"open","locked":false,"title":"[ruby] support for ssl encryption and CA verification","user":{"login":"jipperinbham","id":829493,"avatar_url":"https://avatars.githubusercontent.com/u/829493?v=3","gravatar_id":"","url":"https://api.github.com/users/jipperinbham","html_url":"https://github.com/jipperinbham","followers_url":"https://api.github.com/users/jipperinbham/followers","following_url":"https://api.github.com/users/jipperinbham/following{/other_user}","gists_url":"https://api.github.com/users/jipperinbham/gists{/gist_id}","starred_url":"https://api.github.com/users/jipperinbham/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jipperinbham/subscriptions","organizations_url":"https://api.github.com/users/jipperinbham/orgs","repos_url":"https://api.github.com/users/jipperinbham/repos","events_url":"https://api.github.com/users/jipperinbham/events{/privacy}","received_events_url":"https://api.github.com/users/jipperinbham/received_events","type":"User","site_admin":false},"body":"[Addresses Ruby Driver](https://github.com/rethinkdb/rethinkdb/issues/3158)\r\n\r\nThe following abstracts the socket connection out a bit to allow for creating an SSL connection to a cluster. In order for this to be used, you'd need a proxy (Haproxy, nginx, etc) sitting in front of the RethinkDB cluster performing the SSL verification.\r\n\r\nFor now, the SSL support is only good for encrypting traffic and verifying the CA certification to prevent MITM attacks. ","created_at":"2015-04-17T16:40:36Z","updated_at":"2015-04-18T04:23:49Z","closed_at":null,"merged_at":null,"merge_commit_sha":"a6edfee2d6f6ee639b3cd3fa0633441abf3c3d57","assignee":{"login":"mlucy","id":1777134,"avatar_url":"https://avatars.githubusercontent.com/u/1777134?v=3","gravatar_id":"","url":"https://api.github.com/users/mlucy","html_url":"https://github.com/mlucy","followers_url":"https://api.github.com/users/mlucy/followers","following_url":"https://api.github.com/users/mlucy/following{/other_user}","gists_url":"https://api.github.com/users/mlucy/gists{/gist_id}","starred_url":"https://api.github.com/users/mlucy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mlucy/subscriptions","organizations_url":"https://api.github.com/users/mlucy/orgs","repos_url":"https://api.github.com/users/mlucy/repos","events_url":"https://api.github.com/users/mlucy/events{/privacy}","received_events_url":"https://api.github.com/users/mlucy/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/rethinkdb/rethinkdb/pulls/4075/commits","review_comments_url":"https://api.github.com/repos/rethinkdb/rethinkdb/pulls/4075/comments","review_comment_url":"https://api.github.com/repos/rethinkdb/rethinkdb/pulls/comments{/number}","comments_url":"https://api.github.com/repos/rethinkdb/rethinkdb/issues/4075/comments","statuses_url":"https://api.github.com/repos/rethinkdb/rethinkdb/statuses/929ed8153294698493313437d1c2a700998d7017","head":{"label":"compose:ruby-ssl","ref":"ruby-ssl","sha":"929ed8153294698493313437d1c2a700998d7017","user":{"login":"compose","id":9220126,"avatar_url":"https://avatars.githubusercontent.com/u/9220126?v=3","gravatar_id":"","url":"https://api.github.com/users/compose","html_url":"https://github.com/compose","followers_url":"https://api.github.com/users/compose/followers","following_url":"https://api.github.com/users/compose/following{/other_user}","gists_url":"https://api.github.com/users/compose/gists{/gist_id}","starred_url":"https://api.github.com/users/compose/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/compose/subscriptions","organizations_url":"https://api.github.com/users/compose/orgs","repos_url":"https://api.github.com/users/compose/repos","events_url":"https://api.github.com/users/compose/events{/privacy}","received_events_url":"https://api.github.com/users/compose/received_events","type":"Organization","site_admin":false},"repo":{"id":33940579,"name":"rethinkdb","full_name":"compose/rethinkdb","owner":{"login":"compose","id":9220126,"avatar_url":"https://avatars.githubusercontent.com/u/9220126?v=3","gravatar_id":"","url":"https://api.github.com/users/compose","html_url":"https://github.com/compose","followers_url":"https://api.github.com/users/compose/followers","following_url":"https://api.github.com/users/compose/following{/other_user}","gists_url":"https://api.github.com/users/compose/gists{/gist_id}","starred_url":"https://api.github.com/users/compose/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/compose/subscriptions","organizations_url":"https://api.github.com/users/compose/orgs","repos_url":"https://api.github.com/users/compose/repos","events_url":"https://api.github.com/users/compose/events{/privacy}","received_events_url":"https://api.github.com/users/compose/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/compose/rethinkdb","description":"An open-source distributed JSON document database with a pleasant and powerful query language.","fork":true,"url":"https://api.github.com/repos/compose/rethinkdb","forks_url":"https://api.github.com/repos/compose/rethinkdb/forks","keys_url":"https://api.github.com/repos/compose/rethinkdb/keys{/key_id}","collaborators_url":"https://api.github.com/repos/compose/rethinkdb/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/compose/rethinkdb/teams","hooks_url":"https://api.github.com/repos/compose/rethinkdb/hooks","issue_events_url":"https://api.github.com/repos/compose/rethinkdb/issues/events{/number}","events_url":"https://api.github.com/repos/compose/rethinkdb/events","assignees_url":"https://api.github.com/repos/compose/rethinkdb/assignees{/user}","branches_url":"https://api.github.com/repos/compose/rethinkdb/branches{/branch}","tags_url":"https://api.github.com/repos/compose/rethinkdb/tags","blobs_url":"https://api.github.com/repos/compose/rethinkdb/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/compose/rethinkdb/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/compose/rethinkdb/git/refs{/sha}","trees_url":"https://api.github.com/repos/compose/rethinkdb/git/trees{/sha}","statuses_url":"https://api.github.com/repos/compose/rethinkdb/statuses/{sha}","languages_url":"https://api.github.com/repos/compose/rethinkdb/languages","stargazers_url":"https://api.github.com/repos/compose/rethinkdb/stargazers","contributors_url":"https://api.github.com/repos/compose/rethinkdb/contributors","subscribers_url":"https://api.github.com/repos/compose/rethinkdb/subscribers","subscription_url":"https://api.github.com/repos/compose/rethinkdb/subscription","commits_url":"https://api.github.com/repos/compose/rethinkdb/commits{/sha}","git_commits_url":"https://api.github.com/repos/compose/rethinkdb/git/commits{/sha}","comments_url":"https://api.github.com/repos/compose/rethinkdb/comments{/number}","issue_comment_url":"https://api.github.com/repos/compose/rethinkdb/issues/comments{/number}","contents_url":"https://api.github.com/repos/compose/rethinkdb/contents/{+path}","compare_url":"https://api.github.com/repos/compose/rethinkdb/compare/{base}...{head}","merges_url":"https://api.github.com/repos/compose/rethinkdb/merges","archive_url":"https://api.github.com/repos/compose/rethinkdb/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/compose/rethinkdb/downloads","issues_url":"https://api.github.com/repos/compose/rethinkdb/issues{/number}","pulls_url":"https://api.github.com/repos/compose/rethinkdb/pulls{/number}","milestones_url":"https://api.github.com/repos/compose/rethinkdb/milestones{/number}","notifications_url":"https://api.github.com/repos/compose/rethinkdb/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/compose/rethinkdb/labels{/name}","releases_url":"https://api.github.com/repos/compose/rethinkdb/releases{/id}","created_at":"2015-04-14T15:36:05Z","updated_at":"2015-04-14T15:36:15Z","pushed_at":"2015-04-17T20:14:11Z","git_url":"git://github.com/compose/rethinkdb.git","ssh_url":"git@github.com:compose/rethinkdb.git","clone_url":"https://github.com/compose/rethinkdb.git","svn_url":"https://github.com/compose/rethinkdb","homepage":"http://www.rethinkdb.com","size":115693,"stargazers_count":0,"watchers_count":0,"language":"C++","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"next"}},"base":{"label":"rethinkdb:next","ref":"next","sha":"90051951031cc6d269e93a334f9f045f5bff239d","user":{"login":"rethinkdb","id":1229647,"avatar_url":"https://avatars.githubusercontent.com/u/1229647?v=3","gravatar_id":"","url":"https://api.github.com/users/rethinkdb","html_url":"https://github.com/rethinkdb","followers_url":"https://api.github.com/users/rethinkdb/followers","following_url":"https://api.github.com/users/rethinkdb/following{/other_user}","gists_url":"https://api.github.com/users/rethinkdb/gists{/gist_id}","starred_url":"https://api.github.com/users/rethinkdb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rethinkdb/subscriptions","organizations_url":"https://api.github.com/users/rethinkdb/orgs","repos_url":"https://api.github.com/users/rethinkdb/repos","events_url":"https://api.github.com/users/rethinkdb/events{/privacy}","received_events_url":"https://api.github.com/users/rethinkdb/received_events","type":"Organization","site_admin":false},"repo":{"id":6452529,"name":"rethinkdb","full_name":"rethinkdb/rethinkdb","owner":{"login":"rethinkdb","id":1229647,"avatar_url":"https://avatars.githubusercontent.com/u/1229647?v=3","gravatar_id":"","url":"https://api.github.com/users/rethinkdb","html_url":"https://github.com/rethinkdb","followers_url":"https://api.github.com/users/rethinkdb/followers","following_url":"https://api.github.com/users/rethinkdb/following{/other_user}","gists_url":"https://api.github.com/users/rethinkdb/gists{/gist_id}","starred_url":"https://api.github.com/users/rethinkdb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rethinkdb/subscriptions","organizations_url":"https://api.github.com/users/rethinkdb/orgs","repos_url":"https://api.github.com/users/rethinkdb/repos","events_url":"https://api.github.com/users/rethinkdb/events{/privacy}","received_events_url":"https://api.github.com/users/rethinkdb/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/rethinkdb/rethinkdb","description":"An open-source distributed JSON document database with a pleasant and powerful query language.","fork":false,"url":"https://api.github.com/repos/rethinkdb/rethinkdb","forks_url":"https://api.github.com/repos/rethinkdb/rethinkdb/forks","keys_url":"https://api.github.com/repos/rethinkdb/rethinkdb/keys{/key_id}","collaborators_url":"https://api.github.com/repos/rethinkdb/rethinkdb/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/rethinkdb/rethinkdb/teams","hooks_url":"https://api.github.com/repos/rethinkdb/rethinkdb/hooks","issue_events_url":"https://api.github.com/repos/rethinkdb/rethinkdb/issues/events{/number}","events_url":"https://api.github.com/repos/rethinkdb/rethinkdb/events","assignees_url":"https://api.github.com/repos/rethinkdb/rethinkdb/assignees{/user}","branches_url":"https://api.github.com/repos/rethinkdb/rethinkdb/branches{/branch}","tags_url":"https://api.github.com/repos/rethinkdb/rethinkdb/tags","blobs_url":"https://api.github.com/repos/rethinkdb/rethinkdb/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/rethinkdb/rethinkdb/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/rethinkdb/rethinkdb/git/refs{/sha}","trees_url":"https://api.github.com/repos/rethinkdb/rethinkdb/git/trees{/sha}","statuses_url":"https://api.github.com/repos/rethinkdb/rethinkdb/statuses/{sha}","languages_url":"https://api.github.com/repos/rethinkdb/rethinkdb/languages","stargazers_url":"https://api.github.com/repos/rethinkdb/rethinkdb/stargazers","contributors_url":"https://api.github.com/repos/rethinkdb/rethinkdb/contributors","subscribers_url":"https://api.github.com/repos/rethinkdb/rethinkdb/subscribers","subscription_url":"https://api.github.com/repos/rethinkdb/rethinkdb/subscription","commits_url":"https://api.github.com/repos/rethinkdb/rethinkdb/commits{/sha}","git_commits_url":"https://api.github.com/repos/rethinkdb/rethinkdb/git/commits{/sha}","comments_url":"https://api.github.com/repos/rethinkdb/rethinkdb/comments{/number}","issue_comment_url":"https://api.github.com/repos/rethinkdb/rethinkdb/issues/comments{/number}","contents_url":"https://api.github.com/repos/rethinkdb/rethinkdb/contents/{+path}","compare_url":"https://api.github.com/repos/rethinkdb/rethinkdb/compare/{base}...{head}","merges_url":"https://api.github.com/repos/rethinkdb/rethinkdb/merges","archive_url":"https://api.github.com/repos/rethinkdb/rethinkdb/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/rethinkdb/rethinkdb/downloads","issues_url":"https://api.github.com/repos/rethinkdb/rethinkdb/issues{/number}","pulls_url":"https://api.github.com/repos/rethinkdb/rethinkdb/pulls{/number}","milestones_url":"https://api.github.com/repos/rethinkdb/rethinkdb/milestones{/number}","notifications_url":"https://api.github.com/repos/rethinkdb/rethinkdb/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/rethinkdb/rethinkdb/labels{/name}","releases_url":"https://api.github.com/repos/rethinkdb/rethinkdb/releases{/id}","created_at":"2012-10-30T05:37:47Z","updated_at":"2015-04-18T04:14:04Z","pushed_at":"2015-04-18T02:01:12Z","git_url":"git://github.com/rethinkdb/rethinkdb.git","ssh_url":"git@github.com:rethinkdb/rethinkdb.git","clone_url":"https://github.com/rethinkdb/rethinkdb.git","svn_url":"https://github.com/rethinkdb/rethinkdb","homepage":"http://www.rethinkdb.com","size":450671,"stargazers_count":8450,"watchers_count":8450,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":730,"mirror_url":null,"open_issues_count":904,"forks":730,"open_issues":904,"watchers":8450,"default_branch":"next"}},"_links":{"self":{"href":"https://api.github.com/repos/rethinkdb/rethinkdb/pulls/4075"},"html":{"href":"https://github.com/rethinkdb/rethinkdb/pull/4075"},"issue":{"href":"https://api.github.com/repos/rethinkdb/rethinkdb/issues/4075"},"comments":{"href":"https://api.github.com/repos/rethinkdb/rethinkdb/issues/4075/comments"},"review_comments":{"href":"https://api.github.com/repos/rethinkdb/rethinkdb/pulls/4075/comments"},"review_comment":{"href":"https://api.github.com/repos/rethinkdb/rethinkdb/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/rethinkdb/rethinkdb/pulls/4075/commits"},"statuses":{"href":"https://api.github.com/repos/rethinkdb/rethinkdb/statuses/929ed8153294698493313437d1c2a700998d7017"}}}}