Forum: Ruby-core [ruby-trunk - Bug #9125][Open] Net::SMTP - invalid method raised when attempting to connect using ST

63d90906e7d270d6ad70455c02d379f4?d=identicon&s=25 pveselov (Pawel Veselov) (Guest)
on 2013-11-19 03:55
(Received via mailing list)
Issue #9125 has been reported by pveselov (Pawel Veselov).

----------------------------------------
Bug #9125: Net::SMTP - invalid method raised when attempting to connect
using STARTTLS
https://bugs.ruby-lang.org/issues/9125

Author: pveselov (Pawel Veselov)
Status: Open
Priority: Normal
Assignee:
Category: lib
Target version:
ruby -v: ruby 2.0.0p247 (2013-06-27 revision 41674) [x86_64-linux]
Backport: 1.9.3: UNKNOWN, 2.0.0: UNKNOWN


Simple attempt (in irb):

require 'net/smtp'
smtp = Net::SMTP.new('server', 587)
mtp.enable_starttls()
smtp.start()

NoMethodError: undefined method `success?' for "200 dummy reply
code":String
  from
/usr/local/rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/net/smtp.rb:949:in
`check_response'
  from
/usr/local/rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/net/smtp.rb:554:in
`do_start'
  from
/usr/local/rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/net/smtp.rb:525:in
`start'
  from (irb):9
  from /usr/local/rvm/rubies/ruby-2.0.0-p247/bin/irb:13:in `<main>'

The problem is with the critical() method, the method returns the "dummy
response" if there already was a pending error.
The fix is to replace the line of:

      return '200 dummy reply code' if @error_occured

to

      return Response.parse('200 dummy reply code') if @error_occured

Alternatively, one can have a "canned" dummy response instance, but that
may be unnecessary considering this only happens in error path.
Eabad423977cfc6873b8f5df62b848a6?d=identicon&s=25 hsbt (Hiroshi SHIBATA) (Guest)
on 2013-11-29 11:07
(Received via mailing list)
Issue #9125 has been updated by hsbt (Hiroshi SHIBATA).

Assignee set to drbrain (Eric Hodel)

Could you review this?
----------------------------------------
Bug #9125: Net::SMTP - invalid method raised when attempting to connect
using STARTTLS
https://bugs.ruby-lang.org/issues/9125#change-43248

Author: pveselov (Pawel Veselov)
Status: Open
Priority: Normal
Assignee: drbrain (Eric Hodel)
Category: lib
Target version:
ruby -v: ruby 2.0.0p247 (2013-06-27 revision 41674) [x86_64-linux]
Backport: 1.9.3: UNKNOWN, 2.0.0: UNKNOWN


Simple attempt (in irb):

require 'net/smtp'
smtp = Net::SMTP.new('server', 587)
mtp.enable_starttls()
smtp.start()

NoMethodError: undefined method `success?' for "200 dummy reply
code":String
  from
/usr/local/rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/net/smtp.rb:949:in
`check_response'
  from
/usr/local/rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/net/smtp.rb:554:in
`do_start'
  from
/usr/local/rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/net/smtp.rb:525:in
`start'
  from (irb):9
  from /usr/local/rvm/rubies/ruby-2.0.0-p247/bin/irb:13:in `<main>'

The problem is with the critical() method, the method returns the "dummy
response" if there already was a pending error.
The fix is to replace the line of:

      return '200 dummy reply code' if @error_occured

to

      return Response.parse('200 dummy reply code') if @error_occured

Alternatively, one can have a "canned" dummy response instance, but that
may be unnecessary considering this only happens in error path.
58479f76374a3ba3c69b9804163f39f4?d=identicon&s=25 drbrain (Eric Hodel) (Guest)
on 2013-12-02 06:22
(Received via mailing list)
Issue #9125 has been updated by drbrain (Eric Hodel).

Backport changed from 1.9.3: UNKNOWN, 2.0.0: UNKNOWN to 1.9.3: UNKNOWN,
2.0.0: REQUIRED

All other callers of #critical expect a Net::SMTP::Response so it seems
Pawel's patch is correct.
----------------------------------------
Bug #9125: Net::SMTP - invalid method raised when attempting to connect
using STARTTLS
https://bugs.ruby-lang.org/issues/9125#change-43350

Author: pveselov (Pawel Veselov)
Status: Closed
Priority: Normal
Assignee: drbrain (Eric Hodel)
Category: lib
Target version:
ruby -v: ruby 2.0.0p247 (2013-06-27 revision 41674) [x86_64-linux]
Backport: 1.9.3: UNKNOWN, 2.0.0: REQUIRED


Simple attempt (in irb):

require 'net/smtp'
smtp = Net::SMTP.new('server', 587)
mtp.enable_starttls()
smtp.start()

NoMethodError: undefined method `success?' for "200 dummy reply
code":String
  from
/usr/local/rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/net/smtp.rb:949:in
`check_response'
  from
/usr/local/rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/net/smtp.rb:554:in
`do_start'
  from
/usr/local/rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/net/smtp.rb:525:in
`start'
  from (irb):9
  from /usr/local/rvm/rubies/ruby-2.0.0-p247/bin/irb:13:in `<main>'

The problem is with the critical() method, the method returns the "dummy
response" if there already was a pending error.
The fix is to replace the line of:

      return '200 dummy reply code' if @error_occured

to

      return Response.parse('200 dummy reply code') if @error_occured

Alternatively, one can have a "canned" dummy response instance, but that
may be unnecessary considering this only happens in error path.
5cf8f058a4c094bb708174fb43e7a387?d=identicon&s=25 nagachika (Tomoyuki Chikanaga) (Guest)
on 2013-12-24 17:22
(Received via mailing list)
Issue #9125 has been updated by nagachika (Tomoyuki Chikanaga).

Backport changed from 1.9.3: UNKNOWN, 2.0.0: REQUIRED to 1.9.3: UNKNOWN,
2.0.0: DONE

r43954 was backported to ruby_2_0_0 at r44393.
----------------------------------------
Bug #9125: Net::SMTP - invalid method raised when attempting to connect
using STARTTLS
https://bugs.ruby-lang.org/issues/9125#change-43877

Author: pveselov (Pawel Veselov)
Status: Closed
Priority: Normal
Assignee: drbrain (Eric Hodel)
Category: lib
Target version:
ruby -v: ruby 2.0.0p247 (2013-06-27 revision 41674) [x86_64-linux]
Backport: 1.9.3: UNKNOWN, 2.0.0: DONE


Simple attempt (in irb):

require 'net/smtp'
smtp = Net::SMTP.new('server', 587)
mtp.enable_starttls()
smtp.start()

NoMethodError: undefined method `success?' for "200 dummy reply
code":String
  from
/usr/local/rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/net/smtp.rb:949:in
`check_response'
  from
/usr/local/rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/net/smtp.rb:554:in
`do_start'
  from
/usr/local/rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/net/smtp.rb:525:in
`start'
  from (irb):9
  from /usr/local/rvm/rubies/ruby-2.0.0-p247/bin/irb:13:in `<main>'

The problem is with the critical() method, the method returns the "dummy
response" if there already was a pending error.
The fix is to replace the line of:

      return '200 dummy reply code' if @error_occured

to

      return Response.parse('200 dummy reply code') if @error_occured

Alternatively, one can have a "canned" dummy response instance, but that
may be unnecessary considering this only happens in error path.
8cbb39dadafaf2287a83a13ee4981ec9?d=identicon&s=25 unknown (Guest)
on 2014-01-29 05:51
(Received via mailing list)
Issue #9125 has been updated by Usaku NAKAMURA.

Backport changed from 1.9.3: UNKNOWN, 2.0.0: DONE to 1.9.3: DONE, 2.0.0:
DONE

backported into ruby_1_9_3 at r44741.

----------------------------------------
Bug #9125: Net::SMTP - invalid method raised when attempting to connect
using STARTTLS
https://bugs.ruby-lang.org/issues/9125#change-44680

* Author: Pawel Veselov
* Status: Closed
* Priority: Normal
* Assignee: Eric Hodel
* Category: lib
* Target version:
* ruby -v: ruby 2.0.0p247 (2013-06-27 revision 41674) [x86_64-linux]
* Backport: 1.9.3: DONE, 2.0.0: DONE
----------------------------------------
Simple attempt (in irb):

require 'net/smtp'
smtp = Net::SMTP.new('server', 587)
mtp.enable_starttls()
smtp.start()

NoMethodError: undefined method `success?' for "200 dummy reply
code":String
  from
/usr/local/rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/net/smtp.rb:949:in
`check_response'
  from
/usr/local/rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/net/smtp.rb:554:in
`do_start'
  from
/usr/local/rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/net/smtp.rb:525:in
`start'
  from (irb):9
  from /usr/local/rvm/rubies/ruby-2.0.0-p247/bin/irb:13:in `<main>'

The problem is with the critical() method, the method returns the "dummy
response" if there already was a pending error.
The fix is to replace the line of:

      return '200 dummy reply code' if @error_occured

to

      return Response.parse('200 dummy reply code') if @error_occured

Alternatively, one can have a "canned" dummy response instance, but that
may be unnecessary considering this only happens in error path.
This topic is locked and can not be replied to.