Class: MailSmtp::Session
- Inherits:
-
Object
- Object
- MailSmtp::Session
- Defined in:
- lib/mailsmtp/session.rb
Overview
Per-connection state for one SMTP conversation: where the client is in the command sequence, who they authenticated as, and the envelope they are building. One Session lives for the life of a single connection and is handed to every hook on Server. Subclass via Server#build_session.
Message bytes are not stored here — during DATA the engine passes a live
DataReader into Server#receive.
Defined Under Namespace
Classes: Envelope
Instance Attribute Summary collapse
-
#auth_failures ⇒ Object
Returns the value of attribute auth_failures.
-
#auth_login_username ⇒ Object
Returns the value of attribute auth_login_username.
-
#authenticated_at ⇒ Object
Returns the value of attribute authenticated_at.
-
#authentication_id ⇒ Object
Returns the value of attribute authentication_id.
-
#authorization_id ⇒ Object
Returns the value of attribute authorization_id.
-
#close_after_reply ⇒ Object
Returns the value of attribute close_after_reply.
-
#connected_at ⇒ Object
Returns the value of attribute connected_at.
-
#encrypted_at ⇒ Object
Returns the value of attribute encrypted_at.
-
#envelope ⇒ Object
readonly
Returns the value of attribute envelope.
-
#exceptions ⇒ Object
Returns the value of attribute exceptions.
-
#helo ⇒ Object
Returns the value of attribute helo.
-
#helo_response ⇒ Object
Returns the value of attribute helo_response.
-
#local_ip ⇒ Object
Returns the value of attribute local_ip.
-
#local_response ⇒ Object
Returns the value of attribute local_response.
-
#phase ⇒ Object
Returns the value of attribute phase.
-
#proxy ⇒ Object
Returns the value of attribute proxy.
-
#remote_ip ⇒ Object
Returns the value of attribute remote_ip.
-
#tls_cipher ⇒ Object
Returns the value of attribute tls_cipher.
-
#tls_version ⇒ Object
Returns the value of attribute tls_version.
Instance Method Summary collapse
- #authenticated? ⇒ Boolean
- #encrypted? ⇒ Boolean
-
#initialize ⇒ Session
constructor
A new instance of Session.
-
#reset ⇒ Object
Clear the per-message state — envelope and command sequence — while keeping the connection and its authentication.
-
#reset_authentication ⇒ Object
Drop identity asserted before STARTTLS (RFC 3207 §4.2).
Constructor Details
#initialize ⇒ Session
Returns a new instance of Session.
27 28 29 30 31 32 33 34 35 36 |
# File 'lib/mailsmtp/session.rb', line 27 def initialize @exceptions = 0 @auth_failures = 0 @proxy = nil @close_after_reply = false @tls_version = nil @tls_cipher = nil reset @phase = :helo end |
Instance Attribute Details
#auth_failures ⇒ Object
Returns the value of attribute auth_failures.
19 20 21 |
# File 'lib/mailsmtp/session.rb', line 19 def auth_failures @auth_failures end |
#auth_login_username ⇒ Object
Returns the value of attribute auth_login_username.
19 20 21 |
# File 'lib/mailsmtp/session.rb', line 19 def auth_login_username @auth_login_username end |
#authenticated_at ⇒ Object
Returns the value of attribute authenticated_at.
19 20 21 |
# File 'lib/mailsmtp/session.rb', line 19 def authenticated_at @authenticated_at end |
#authentication_id ⇒ Object
Returns the value of attribute authentication_id.
19 20 21 |
# File 'lib/mailsmtp/session.rb', line 19 def authentication_id @authentication_id end |
#authorization_id ⇒ Object
Returns the value of attribute authorization_id.
19 20 21 |
# File 'lib/mailsmtp/session.rb', line 19 def @authorization_id end |
#close_after_reply ⇒ Object
Returns the value of attribute close_after_reply.
19 20 21 |
# File 'lib/mailsmtp/session.rb', line 19 def close_after_reply @close_after_reply end |
#connected_at ⇒ Object
Returns the value of attribute connected_at.
19 20 21 |
# File 'lib/mailsmtp/session.rb', line 19 def connected_at @connected_at end |
#encrypted_at ⇒ Object
Returns the value of attribute encrypted_at.
19 20 21 |
# File 'lib/mailsmtp/session.rb', line 19 def encrypted_at @encrypted_at end |
#envelope ⇒ Object (readonly)
Returns the value of attribute envelope.
25 26 27 |
# File 'lib/mailsmtp/session.rb', line 25 def envelope @envelope end |
#exceptions ⇒ Object
Returns the value of attribute exceptions.
19 20 21 |
# File 'lib/mailsmtp/session.rb', line 19 def exceptions @exceptions end |
#helo ⇒ Object
Returns the value of attribute helo.
19 20 21 |
# File 'lib/mailsmtp/session.rb', line 19 def helo @helo end |
#helo_response ⇒ Object
Returns the value of attribute helo_response.
19 20 21 |
# File 'lib/mailsmtp/session.rb', line 19 def helo_response @helo_response end |
#local_ip ⇒ Object
Returns the value of attribute local_ip.
19 20 21 |
# File 'lib/mailsmtp/session.rb', line 19 def local_ip @local_ip end |
#local_response ⇒ Object
Returns the value of attribute local_response.
19 20 21 |
# File 'lib/mailsmtp/session.rb', line 19 def local_response @local_response end |
#phase ⇒ Object
Returns the value of attribute phase.
19 20 21 |
# File 'lib/mailsmtp/session.rb', line 19 def phase @phase end |
#proxy ⇒ Object
Returns the value of attribute proxy.
19 20 21 |
# File 'lib/mailsmtp/session.rb', line 19 def proxy @proxy end |
#remote_ip ⇒ Object
Returns the value of attribute remote_ip.
19 20 21 |
# File 'lib/mailsmtp/session.rb', line 19 def remote_ip @remote_ip end |
#tls_cipher ⇒ Object
Returns the value of attribute tls_cipher.
19 20 21 |
# File 'lib/mailsmtp/session.rb', line 19 def tls_cipher @tls_cipher end |
#tls_version ⇒ Object
Returns the value of attribute tls_version.
19 20 21 |
# File 'lib/mailsmtp/session.rb', line 19 def tls_version @tls_version end |
Instance Method Details
#authenticated? ⇒ Boolean
55 56 57 |
# File 'lib/mailsmtp/session.rb', line 55 def authenticated? !authenticated_at.nil? end |
#encrypted? ⇒ Boolean
59 60 61 |
# File 'lib/mailsmtp/session.rb', line 59 def encrypted? !encrypted_at.nil? end |
#reset ⇒ Object
Clear the per-message state — envelope and command sequence — while keeping the connection and its authentication. Used on RSET and at the end of each accepted message.
41 42 43 44 45 |
# File 'lib/mailsmtp/session.rb', line 41 def reset @phase = :ready @envelope = Envelope.new @auth_login_username = nil end |
#reset_authentication ⇒ Object
Drop identity asserted before STARTTLS (RFC 3207 §4.2).
48 49 50 51 52 53 |
# File 'lib/mailsmtp/session.rb', line 48 def reset_authentication @authenticated_at = nil @authorization_id = nil @authentication_id = nil @auth_login_username = nil end |