blather 0.8.4 → 0.8.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4c8d4444b9fed6c401deb5d97c8c984fead573f8
4
- data.tar.gz: 1e303cf3c013030d2ce92be183ec13ce3410f1e4
3
+ metadata.gz: 814d92df4c498de84d675ae72989b9fd37a44f71
4
+ data.tar.gz: 30e5f51f563153e26fd4bb7941295a4102a86507
5
5
  SHA512:
6
- metadata.gz: 1dcd5964fee72197c4d90c97ecc002fbdafa036645f4066467b03b55e3d5017d297626c0fc7fb22624bc46179397292a3decab49c0a189726ba614319eefcfd0
7
- data.tar.gz: 5df62c1b0c02c5054c84fcfc05f34259ed64e16917d32fabed0227c055343cc966729f012e3d44550bd000ab13c8f7c76c15e495325b71ef6bb09813d506c6d9
6
+ metadata.gz: d73eeabd9156c0a01810b82e46540cc95689128260ec131d8a01f7633fdb84e06e8b9219258e0ad392c18d1572b8e5a72134ffc674f30a8dc05e1dd3ad62c35f
7
+ data.tar.gz: e7f514173219c93df7af0858ecdfa6cbe16e17a2c6c86f8e053df9f0f7c63a3869ae86c75b4401b8d85b988dab3b413c39fb972aca5958d12f77380154048602
@@ -5,5 +5,8 @@ rvm:
5
5
  - jruby-19mode
6
6
  - rbx-19mode
7
7
  - ruby-head
8
+ matrix:
9
+ allow_failures:
10
+ - rvm: jruby-19mode
8
11
  notifications:
9
12
  irc: "irc.freenode.org#adhearsion"
@@ -1,5 +1,8 @@
1
1
  # [develop](https://github.com/adhearsion/blather/compare/master...develop)
2
2
 
3
+ # [v0.8.5](https://github.com/adhearsion/blather/compare/v0.8.4...v0.8.5) - [2013-06-01](https://rubygems.org/gems/blather/versions/0.8.5)
4
+ * Bugfix: Ensure that binding is always performed before session creation, regardless of the order of elements in the feature set provided by the server. This was causing incompatability with Tigase.
5
+
3
6
  # [v0.8.4](https://github.com/adhearsion/blather/compare/v0.8.3...v0.8.4) - [2013-03-20](https://rubygems.org/gems/blather/versions/0.8.4)
4
7
  * Bugfix: Only finish stream parser if there is one. This prevents crashes on failure to connect.
5
8
 
@@ -26,6 +26,12 @@ class Stream
26
26
  end
27
27
 
28
28
  def next!
29
+ bind = @features.at_xpath('ns:bind', ns: 'urn:ietf:params:xml:ns:xmpp-bind')
30
+ session = @features.at_xpath('ns:session', ns: 'urn:ietf:params:xml:ns:xmpp-session')
31
+ if bind && session && @features.children.last != session
32
+ @features.children.after session
33
+ end
34
+
29
35
  @idx = @idx ? @idx+1 : 0
30
36
  if stanza = @features.children[@idx]
31
37
  if stanza.namespaces['xmlns'] && (klass = self.class.from_namespace(stanza.namespaces['xmlns']))
@@ -1,3 +1,3 @@
1
1
  module Blather
2
- VERSION = '0.8.4'
2
+ VERSION = '0.8.5'
3
3
  end
@@ -877,6 +877,41 @@ describe Blather::Stream::Client do
877
877
  end
878
878
  end
879
879
 
880
+ it 'will establish a session only after a bind' do
881
+ # fixes #95 client auth issue w/ Tigase: handles random order of stream:features items, f.e. <session> before <bind>
882
+ # thx @pmashchak
883
+
884
+ state = nil
885
+ mocked_server(3) do |val, server|
886
+ case state
887
+ when nil
888
+ state = :started
889
+ server.send_data "<?xml version='1.0'?><stream:stream xmlns='jabber:client' xmlns:stream='http://etherx.jabber.org/streams'>"
890
+ server.send_data "<stream:features><session xmlns='urn:ietf:params:xml:ns:xmpp-session' /><bind xmlns='urn:ietf:params:xml:ns:xmpp-bind'/></stream:features>"
891
+ val.should match(/stream:stream/)
892
+
893
+ when :started
894
+ state = :complete
895
+ doc = parse_stanza val
896
+ doc.find('/iq[@type="set"]/bind_ns:bind', :bind_ns => Blather::Stream::Resource::BIND_NS).should_not be_empty
897
+ server.send_data "<iq type='result' id='#{doc.find_first('iq')['id']}'><bind xmlns='urn:ietf:params:xml:ns:xmpp-bind'><jid>#{client.jid}</jid></bind></iq>"
898
+ true
899
+
900
+ when :complete
901
+ doc = parse_stanza val
902
+ doc.find('/iq[@type="set"]/sess_ns:session', :sess_ns => Blather::Stream::Session::SESSION_NS).should_not be_empty
903
+ EM.stop
904
+ true
905
+
906
+ else
907
+ EM.stop
908
+ false
909
+
910
+ end
911
+ end
912
+ end
913
+
914
+
880
915
  it 'will return an error if session establishment errors out' do
881
916
  client.expects(:receive_data).with do |n|
882
917
  n.name.should == :internal_server_error
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: blather
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.4
4
+ version: 0.8.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeff Smick
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-03-20 00:00:00.000000000 Z
12
+ date: 2013-06-01 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: eventmachine
@@ -389,7 +389,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
389
389
  version: '0'
390
390
  requirements: []
391
391
  rubyforge_project:
392
- rubygems_version: 2.0.0
392
+ rubygems_version: 2.0.3
393
393
  signing_key:
394
394
  specification_version: 4
395
395
  summary: Simpler XMPP built for speed