Sha256: 57ffc37c2cefbf8d2f250d8e8d8a2bb1fccfab8e4f9fc6075d6e44ff695eff9f

Contents?: true

Size: 895 Bytes

Versions: 13

Compression:

Stored size: 895 Bytes

Contents

module Blather # :nodoc:
class Stream # :nodoc:

  # TLS negotiation invovles 3 node types:
  #   * starttls  -- Server asking for TLS to be started
  #   * proceed   -- Server saying it's ready for a TLS connection to be started
  #   * failure   -- Failed TLS negotiation. Failure results in a closed connection.
  #                  so there's no message to pass back to the tream
  class TLS < StreamHandler # :nodoc:
  private
    ##
    # After receiving <starttls> from the server send one
    # back to let it know we're ready to start TLS
    def starttls
      @stream.send "<starttls xmlns='urn:ietf:params:xml:ns:xmpp-tls'/>"
    end

    ##
    # Server's ready for TLS, so start it up
    def proceed
      @stream.start_tls
      success
    end

    ##
    # Negotiations failed
    def failure
      super StreamError::TLSFailure.new
    end
  end #TLS

end #Stream
end #Blather

Version data entries

13 entries across 13 versions & 2 rubygems

Version Path
sprsquish-blather-0.2.3 lib/blather/stream/tls.rb
sprsquish-blather-0.3.0 lib/blather/stream/tls.rb
sprsquish-blather-0.3.1 lib/blather/stream/tls.rb
sprsquish-blather-0.3.2 lib/blather/stream/tls.rb
sprsquish-blather-0.3.3 lib/blather/stream/tls.rb
sprsquish-blather-0.3.4 lib/blather/stream/tls.rb
blather-0.2.2 lib/blather/stream/tls.rb
blather-0.3.1 lib/blather/stream/tls.rb
blather-0.3.0 lib/blather/stream/tls.rb
blather-0.2.3 lib/blather/stream/tls.rb
blather-0.3.4 lib/blather/stream/tls.rb
blather-0.3.3 lib/blather/stream/tls.rb
blather-0.3.2 lib/blather/stream/tls.rb