remailer 0.4.19 → 0.4.20

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.4.19
1
+ 0.4.20
@@ -27,7 +27,7 @@ class Remailer::Connection::SmtpInterpreter < Remailer::Interpreter
27
27
 
28
28
  # Encodes a string in Base64 as a single line
29
29
  def self.base64(string)
30
- [ string.to_s ].pack('m').chomp
30
+ [ string.to_s ].pack('m').gsub(/\n/, '')
31
31
  end
32
32
 
33
33
  # == State Mapping ========================================================
@@ -102,7 +102,7 @@ class Remailer::Connection::SmtpInterpreter < Remailer::Interpreter
102
102
  end
103
103
 
104
104
  unless (continues)
105
- if (delegate.use_tls? and delegate.tls_support?)
105
+ if (delegate.use_tls? and delegate.tls_support? and !@tls)
106
106
  enter_state(:starttls)
107
107
  elsif (delegate.requires_authentication?)
108
108
  enter_state(:auth)
@@ -111,6 +111,13 @@ class Remailer::Connection::SmtpInterpreter < Remailer::Interpreter
111
111
  end
112
112
  end
113
113
  end
114
+
115
+ interpret(500..599) do |result_code|
116
+ # RFC1869 suggests trying HELO if EHLO results in some kind of error,
117
+ # typically 5xx, but the actual code varies wildly depending on server.
118
+ delegate.protocol = :smtp
119
+ enter_state(:helo)
120
+ end
114
121
  end
115
122
 
116
123
  state :starttls do
@@ -120,8 +127,14 @@ class Remailer::Connection::SmtpInterpreter < Remailer::Interpreter
120
127
 
121
128
  interpret(220) do
122
129
  delegate.start_tls
130
+ @tls = true
123
131
 
124
- enter_state(:re_helo)
132
+ case (delegate.protocol)
133
+ when :esmtp
134
+ enter_state(:ehlo)
135
+ else
136
+ enter_state(:helo)
137
+ end
125
138
  end
126
139
  end
127
140
 
@@ -195,9 +208,10 @@ class Remailer::Connection::SmtpInterpreter < Remailer::Interpreter
195
208
  end
196
209
 
197
210
  interpret(220) do
198
- # "HELO/EHLO command already issued"
199
211
  if (delegate.requires_authentication?)
200
212
  enter_state(:auth)
213
+ elsif (delegate.active_message)
214
+ enter_state(:mail_from)
201
215
  else
202
216
  enter_state(:established)
203
217
  end
@@ -290,6 +304,11 @@ class Remailer::Connection::SmtpInterpreter < Remailer::Interpreter
290
304
  interpret(221) do
291
305
  enter_state(:terminated)
292
306
  end
307
+
308
+ interpret(502) do
309
+ # "502 5.5.2 Error: command not recognized"
310
+ enter_state(:terminated)
311
+ end
293
312
  end
294
313
 
295
314
  state :terminated do
data/remailer.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "remailer"
8
- s.version = "0.4.19"
8
+ s.version = "0.4.20"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Scott Tadman"]
12
- s.date = "2011-10-19"
12
+ s.date = "2011-11-02"
13
13
  s.description = "EventMachine SMTP Mail User Agent"
14
14
  s.email = "scott@twg.ca"
15
15
  s.extra_rdoc_files = [
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: remailer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.19
4
+ version: 0.4.20
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-10-19 00:00:00.000000000Z
12
+ date: 2011-11-02 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: eventmachine
16
- requirement: &2154425060 !ruby/object:Gem::Requirement
16
+ requirement: &2153998580 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,7 +21,7 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *2154425060
24
+ version_requirements: *2153998580
25
25
  description: EventMachine SMTP Mail User Agent
26
26
  email: scott@twg.ca
27
27
  executables: []