Sha256: 58068c21b34f3992031846236d7bddcf9d0dd0784b65c0dfe4321af36166d620

Contents?: true

Size: 807 Bytes

Versions: 32

Compression:

Stored size: 807 Bytes

Contents

# encoding: UTF-8

module Vines
  class Stream
    class Http
      class Bind < Client::Bind
        FEATURES = %Q{<stream:features xmlns:stream="#{NAMESPACES[:stream]}"/>}.freeze

        def initialize(stream, success=Ready)
          super
        end

        def node(node)
          unless stream.valid_session?(node['sid']) && body?(node) && node['rid']
            raise StreamErrors::NotAuthorized
          end
          nodes = stream.parse_body(node)
          raise StreamErrors::NotAuthorized unless nodes.size == 1
          super(nodes.first)
        end

        private

        # Override Client::Bind#send_empty_features to properly namespace the
        # empty features element.
        def send_empty_features
          stream.write(FEATURES)
        end
      end
    end
  end
end

Version data entries

32 entries across 32 versions & 4 rubygems

Version Path
vinesmod-0.4.5 lib/vines/stream/http/bind.rb
vines-0.4.5 lib/vines/stream/http/bind.rb
vines-0.4.4 lib/vines/stream/http/bind.rb
vines-0.4.3 lib/vines/stream/http/bind.rb
vines-0.4.2 lib/vines/stream/http/bind.rb
vines-0.4.1 lib/vines/stream/http/bind.rb
vines-0.4.0 lib/vines/stream/http/bind.rb
vines-0.3.2 lib/vines/stream/http/bind.rb
vines-0.3.1 lib/vines/stream/http/bind.rb
vines-0.3.0 lib/vines/stream/http/bind.rb
vines-0.2.1 lib/vines/stream/http/bind.rb
vines-0.2.0 lib/vines/stream/http/bind.rb