rendezvous 0.0.2 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/CONTRIBUTING.md +18 -0
- data/CONTRIBUTORS.md +6 -0
- data/Gemfile.lock +1 -1
- data/LICENSE.md +20 -0
- data/data/cacert.pem +762 -965
- data/lib/rendezvous.rb +22 -4
- data/lib/rendezvous/version.rb +1 -1
- metadata +8 -8
- data/LICENSE.txt +0 -22
data/lib/rendezvous.rb
CHANGED
@@ -33,13 +33,26 @@ class Rendezvous
|
|
33
33
|
@input = options[:input] || $stdin
|
34
34
|
@output = options[:output] || $stdout
|
35
35
|
@url = options[:url]
|
36
|
+
@ssl_verify_peer = options.fetch(:ssl_verify_peer, true)
|
36
37
|
end
|
37
38
|
|
38
39
|
def start
|
39
40
|
begin
|
40
41
|
`stty -icanon -echo` if input.isatty
|
42
|
+
|
43
|
+
if input.is_a?(StringIO)
|
44
|
+
input.each(DEFAULT_CHUNK_SIZE) do |chunk|
|
45
|
+
socket.write(chunk)
|
46
|
+
socket.flush
|
47
|
+
end
|
48
|
+
|
49
|
+
ios = [socket]
|
50
|
+
else
|
51
|
+
ios = [socket, input]
|
52
|
+
end
|
53
|
+
|
41
54
|
loop do
|
42
|
-
if selected = IO.select(
|
55
|
+
if selected = IO.select(ios, nil, nil, activity_timeout)
|
43
56
|
if selected.first.first == input
|
44
57
|
socket.write(input.readpartial(DEFAULT_CHUNK_SIZE))
|
45
58
|
socket.flush
|
@@ -75,8 +88,13 @@ class Rendezvous
|
|
75
88
|
host, port, secret = uri.host, uri.port, uri.path[1..-1]
|
76
89
|
|
77
90
|
ssl_context = OpenSSL::SSL::SSLContext.new
|
78
|
-
|
79
|
-
|
91
|
+
|
92
|
+
if @ssl_verify_peer
|
93
|
+
ssl_context.ca_file = File.expand_path("../../data/cacert.pem", __FILE__)
|
94
|
+
ssl_context.verify_mode = OpenSSL::SSL::VERIFY_PEER
|
95
|
+
else
|
96
|
+
ssl_context.verify_mode = OpenSSL::SSL::VERIFY_NONE
|
97
|
+
end
|
80
98
|
|
81
99
|
Timeout.timeout(connect_timeout) do
|
82
100
|
tcp_socket = TCPSocket.open(host, port)
|
@@ -85,7 +103,7 @@ class Rendezvous
|
|
85
103
|
ssl_socket.sync_close = true
|
86
104
|
|
87
105
|
ssl_socket.hostname = host # SNI
|
88
|
-
ssl_socket.post_connection_check(host)
|
106
|
+
ssl_socket.post_connection_check(host) if @ssl_verify_peer
|
89
107
|
|
90
108
|
ssl_socket.puts(secret)
|
91
109
|
ssl_socket.readline
|
data/lib/rendezvous/version.rb
CHANGED
metadata
CHANGED
@@ -1,15 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rendezvous
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
5
|
-
prerelease:
|
4
|
+
version: 0.1.0
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- geemus
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2014-05-22 00:00:00.000000000 Z
|
13
12
|
dependencies: []
|
14
13
|
description: Client for interacting with Heroku processes.
|
15
14
|
email:
|
@@ -19,9 +18,11 @@ extensions: []
|
|
19
18
|
extra_rdoc_files: []
|
20
19
|
files:
|
21
20
|
- .gitignore
|
21
|
+
- CONTRIBUTING.md
|
22
|
+
- CONTRIBUTORS.md
|
22
23
|
- Gemfile
|
23
24
|
- Gemfile.lock
|
24
|
-
- LICENSE.
|
25
|
+
- LICENSE.md
|
25
26
|
- README.md
|
26
27
|
- Rakefile
|
27
28
|
- data/cacert.pem
|
@@ -30,27 +31,26 @@ files:
|
|
30
31
|
- rendezvous.gemspec
|
31
32
|
homepage: http://github.com/heroku/rendezvous.rb
|
32
33
|
licenses: []
|
34
|
+
metadata: {}
|
33
35
|
post_install_message:
|
34
36
|
rdoc_options: []
|
35
37
|
require_paths:
|
36
38
|
- lib
|
37
39
|
required_ruby_version: !ruby/object:Gem::Requirement
|
38
|
-
none: false
|
39
40
|
requirements:
|
40
41
|
- - ! '>='
|
41
42
|
- !ruby/object:Gem::Version
|
42
43
|
version: '0'
|
43
44
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
44
|
-
none: false
|
45
45
|
requirements:
|
46
46
|
- - ! '>='
|
47
47
|
- !ruby/object:Gem::Version
|
48
48
|
version: '0'
|
49
49
|
requirements: []
|
50
50
|
rubyforge_project:
|
51
|
-
rubygems_version:
|
51
|
+
rubygems_version: 2.2.2
|
52
52
|
signing_key:
|
53
|
-
specification_version:
|
53
|
+
specification_version: 4
|
54
54
|
summary: Client for interacting with Heroku processes.
|
55
55
|
test_files: []
|
56
56
|
has_rdoc:
|
data/LICENSE.txt
DELETED
@@ -1,22 +0,0 @@
|
|
1
|
-
Copyright (c) 2012 geemus
|
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.
|