We got nominated! Help us out and vote for GitHub as Best Bootstrapped Startup of 2008. (You can vote once a day.) [ hide ]

public
Fork of benburkert/cruisecontrolrb
Description: CruiseControl.rb is a continuous integration tool, written in Ruby. It is quick to install, simple to use and easy to hack.
Homepage: http://cruisecontrolrb.thoughtworks.com/
Clone URL: git://github.com/dustin/cruisecontrolrb.git
Restart SMTP conversation if STARTTLS failed - some SMTP servers that 
don't support TLS drop the socket at this point

git-svn-id: http://cruisecontrolrb.rubyforge.org/svn/trunk@608 
c04ce798-636b-4ca8-9149-0f9336831111
alexeyv (author)
Mon Feb 25 11:05:57 -0800 2008
commit  fdfc5464be7172e7bf432e31a27b1af6a81e4799
tree    88130e6f426b1d0f6c0c190a5d857f284da02d18
parent  9d72905a5c53889c86ed300d789db0eef7bf442b
...
6
7
8
9
10
11
12
 
13
14
15
16
17
18
 
 
 
 
 
 
 
 
19
20
21
...
53
54
55
56
 
57
58
 
59
60
61
...
64
65
66
 
 
 
 
 
 
 
 
 
 
67
68
69
...
71
72
73
74
75
 
...
6
7
8
 
 
 
 
9
10
 
 
 
 
 
11
12
13
14
15
16
17
18
19
20
21
...
53
54
55
 
56
57
 
58
59
60
61
...
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
...
81
82
83
 
84
85
0
@@ -6,16 +6,16 @@ Net::SMTP.class_eval do
0
     raise IOError, 'SMTP session already started' if @started
0
     check_auth_args user, secret, authtype if user or secret
0
 
0
- socket = timeout(@open_timeout) { TCPSocket.open(@address, @port) }
0
- @socket = Net::InternetMessageIO.new(socket)
0
- @socket.read_timeout = 60 #@read_timeout
0
- @socket.debug_output = STDERR #@debug_output
0
+ open_conversation(helodomain)
0
 
0
- check_response(critical { recv_response() })
0
- do_helo(helodomain)
0
-
0
-
0
- create_ssl_socket(socket, helodomain) if starttls
0
+ if starttls
0
+ create_ssl_socket(socket, helodomain)
0
+ else
0
+ # some SMTP servers that don't support TLS drop the socket after rejecting
0
+ # STARTTLS command, so reopen the conversation
0
+ @socket.close
0
+ open_conversation(helodomain)
0
+ end
0
 
0
     authenticate user, secret, authtype if user
0
     @started = true
0
@@ -53,9 +53,9 @@ Net::SMTP.class_eval do
0
     end
0
   end
0
 
0
- def create_ssl_socket(underlying_socket, helodomain)
0
+ def create_ssl_socket(helodomain)
0
     require "openssl"
0
- ssl = OpenSSL::SSL::SSLSocket.new(underlying_socket)
0
+ ssl = OpenSSL::SSL::SSLSocket.new(@tcp_socket)
0
     ssl.sync_close = true
0
     ssl.connect
0
     @socket = Net::InternetMessageIO.new(ssl)
0
@@ -64,6 +64,16 @@ Net::SMTP.class_eval do
0
     do_helo(helodomain)
0
   end
0
 
0
+ def open_conversation(helodomain)
0
+ @tcp_socket = timeout(@open_timeout) { TCPSocket.open(@address, @port) }
0
+ @socket = Net::InternetMessageIO.new(@tcp_socket)
0
+ @socket.read_timeout = 60 #@read_timeout
0
+ @socket.debug_output = STDERR #@debug_output
0
+
0
+ check_response(critical { recv_response() })
0
+ do_helo(helodomain)
0
+ end
0
+
0
   def quit
0
     begin
0
       getok('QUIT')
0
@@ -71,4 +81,4 @@ Net::SMTP.class_eval do
0
     end
0
   end
0
 
0
-end
0
\ No newline at end of file
0
+end

Comments

    No one has commented yet.