public
Fork of eventmachine/eventmachine
Description: EventMachine - Sync from svn repo at rubyeventmachine.com
Homepage: http://www.rubyeventmachine.com
Clone URL: git://github.com/tmm1/eventmachine.git
Added start_tls argument checks from brianmario

git-svn-id: http://rubyeventmachine.com/svn/trunk@794 
2c60eb90-88cd-488e-9351-1edcb1d70dbc
raggi (author)
Mon Sep 29 15:28:44 -0700 2008
commit  218e996cca2a7884a1407e849a2a6b08090a3eac
tree    23830535529904eea0786a9000425044d9ad9c45
parent  f6234acb602fd7f97dc19ba0c499010d50710792
...
178
179
180
181
182
 
 
 
183
...
178
179
180
 
181
182
183
184
185
0
@@ -178,4 +178,6 @@ danielaquino, macournoyer.
0
  - Fix a bug in pr_eventmachine for outbound_q
0
  - Refactors to take some of the use of defer out of tests.
0
  - Fixes in EM.defer under start/stop conditions. Reduced scope of threads.
0
-23Sep08: Added patch from tmm1 to avoid popen errors on exit.
0
\ No newline at end of file
0
+23Sep08: Added patch from tmm1 to avoid popen errors on exit.
0
+30Sep08: Added File.exists? checks in the args for start_tls, as suggested by
0
+ Brian Lopez (brianmario).
0
\ No newline at end of file
...
172
173
174
 
 
175
176
177
...
1552
1553
1554
1555
1556
1557
1558
1559
 
 
 
 
 
 
 
 
 
 
1560
1561
1562
...
172
173
174
175
176
177
178
179
...
1554
1555
1556
 
 
 
 
 
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
0
@@ -172,6 +172,8 @@ require 'shellwords'
0
 #
0
 #
0
 module EventMachine
0
+ class FileNotFoundException < Exception; end
0
+
0
   class << self
0
     attr_reader :threadpool
0
   end
0
@@ -1552,11 +1554,16 @@ class Connection
0
   # behaved than the ones for raw chunks of memory.
0
   #
0
   def start_tls args={}
0
- EventMachine::set_tls_parms(
0
- @signature,
0
- args[:private_key_file] || "",
0
- args[:cert_chain_file] || ""
0
- )
0
+ priv_key, cert_chain = args.values_at(:private_key_file, :cert_chain_file)
0
+
0
+ [priv_key, cert_chain].each do |file|
0
+ next if file.nil? or file.empty?
0
+ raise FileNotFoundException,
0
+ "Could not find #{file} for start_tls" unless File.exists? file
0
+ end
0
+
0
+ EventMachine::set_tls_parms(@signature, priv_key || '', cert_chain || '')
0
+
0
     EventMachine::start_tls @signature
0
   end
0
 

Comments

    No one has commented yet.