mad-p-xmpp4r 0.6.1 → 0.6.2
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.
- data/CHANGELOG +6 -0
 - data/lib/xmpp4r/client.rb +1 -1
 - data/lib/xmpp4r/httpbinding/client.rb +11 -8
 - data/lib/xmpp4r/xmpp4r.rb +1 -1
 - data/mad-p-xmpp4r.gemspec +1 -1
 - data/test/ts_xmpp4r.rb +10 -1
 - metadata +2 -2
 
    
        data/CHANGELOG
    CHANGED
    
    | 
         @@ -1,3 +1,9 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            mad-p-xmpp4r 0.6.2 (26/02/2013)
         
     | 
| 
      
 2 
     | 
    
         
            +
            ===============================
         
     | 
| 
      
 3 
     | 
    
         
            +
            * Merge pull request #1 from Strech/patch-1
         
     | 
| 
      
 4 
     | 
    
         
            +
              * Non-bosh connection flushes correctly
         
     | 
| 
      
 5 
     | 
    
         
            +
            * Elaborated debug messages in HTTPBinding::Client
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
       1 
7 
     | 
    
         
             
            mad-p-xmpp4r 0.6.1 (21/02/2013)
         
     | 
| 
       2 
8 
     | 
    
         
             
            ===============================
         
     | 
| 
       3 
9 
     | 
    
         
             
            * Modified to work with BOSH with HTTPBinding::Client
         
     | 
    
        data/lib/xmpp4r/client.rb
    CHANGED
    
    
| 
         @@ -139,7 +139,7 @@ module Jabber 
     | 
|
| 
       139 
139 
     | 
    
         
             
                    end
         
     | 
| 
       140 
140 
     | 
    
         
             
                    req_body.attributes['secure'] = 'true'
         
     | 
| 
       141 
141 
     | 
    
         
             
                    req_body.attributes['xmlns'] = 'http://jabber.org/protocol/httpbind'
         
     | 
| 
       142 
     | 
    
         
            -
                    res_body = post(req_body)
         
     | 
| 
      
 142 
     | 
    
         
            +
                    res_body = post(req_body, "sid=new rid=#{@http_rid}")
         
     | 
| 
       143 
143 
     | 
    
         
             
                    unless res_body.name == 'body'
         
     | 
| 
       144 
144 
     | 
    
         
             
                      raise 'Response body is no <body/> element'
         
     | 
| 
       145 
145 
     | 
    
         
             
                    end
         
     | 
| 
         @@ -192,7 +192,7 @@ module Jabber 
     | 
|
| 
       192 
192 
     | 
    
         
             
                      @pending_requests += 1
         
     | 
| 
       193 
193 
     | 
    
         
             
                      @last_send = Time.now
         
     | 
| 
       194 
194 
     | 
    
         
             
                    }
         
     | 
| 
       195 
     | 
    
         
            -
                    res_body = post(req_body)
         
     | 
| 
      
 195 
     | 
    
         
            +
                    res_body = post(req_body, "terminate sid=#{@http_sid} rid=#{@http_rid}")
         
     | 
| 
       196 
196 
     | 
    
         
             
                    sleep(3)
         
     | 
| 
       197 
197 
     | 
    
         
             
                    Jabber::debuglog("Connection closed")
         
     | 
| 
       198 
198 
     | 
    
         
             
                  end
         
     | 
| 
         @@ -231,13 +231,13 @@ module Jabber 
     | 
|
| 
       231 
231 
     | 
    
         | 
| 
       232 
232 
     | 
    
         
             
                  ##
         
     | 
| 
       233 
233 
     | 
    
         
             
                  # Do a POST request
         
     | 
| 
       234 
     | 
    
         
            -
                  def post(body)
         
     | 
| 
      
 234 
     | 
    
         
            +
                  def post(body, debug_info)
         
     | 
| 
       235 
235 
     | 
    
         
             
                    body = body.to_s
         
     | 
| 
       236 
236 
     | 
    
         
             
                    request = Net::HTTP::Post.new(@uri.path)
         
     | 
| 
       237 
237 
     | 
    
         
             
                    request.content_length = body.size
         
     | 
| 
       238 
238 
     | 
    
         
             
                    request.body = body
         
     | 
| 
       239 
239 
     | 
    
         
             
                    request['Content-Type'] = @http_content_type
         
     | 
| 
       240 
     | 
    
         
            -
                    Jabber::debuglog("HTTP REQUEST (#{@pending_requests}/#{@http_requests}):\n#{request.body}")
         
     | 
| 
      
 240 
     | 
    
         
            +
                    Jabber::debuglog("HTTP REQUEST (#{@pending_requests}/#{@http_requests}) #{debug_info}:\n#{request.body}")
         
     | 
| 
       241 
241 
     | 
    
         | 
| 
       242 
242 
     | 
    
         
             
                    net_http_args = [@uri.host, @uri.port]
         
     | 
| 
       243 
243 
     | 
    
         
             
                    unless @proxy_args.empty?
         
     | 
| 
         @@ -256,7 +256,7 @@ module Jabber 
     | 
|
| 
       256 
256 
     | 
    
         
             
                    response = http.start { |http|
         
     | 
| 
       257 
257 
     | 
    
         
             
                      http.request(request)
         
     | 
| 
       258 
258 
     | 
    
         
             
                    }
         
     | 
| 
       259 
     | 
    
         
            -
                    Jabber::debuglog("HTTP RESPONSE (#{@pending_requests}/#{@http_requests}): #{response.class}\n#{response.body}")
         
     | 
| 
      
 259 
     | 
    
         
            +
                    Jabber::debuglog("HTTP RESPONSE (#{@pending_requests}/#{@http_requests}) #{debug_info}: #{response.class}\n#{response.body}")
         
     | 
| 
       260 
260 
     | 
    
         | 
| 
       261 
261 
     | 
    
         
             
                    unless response.kind_of? Net::HTTPSuccess
         
     | 
| 
       262 
262 
     | 
    
         
             
                      # Unfortunately, HTTPResponses aren't exceptions
         
     | 
| 
         @@ -286,6 +286,7 @@ module Jabber 
     | 
|
| 
       286 
286 
     | 
    
         
             
                  def post_data(data, restart = false)
         
     | 
| 
       287 
287 
     | 
    
         
             
                    req_body = nil
         
     | 
| 
       288 
288 
     | 
    
         
             
                    current_rid = nil
         
     | 
| 
      
 289 
     | 
    
         
            +
                    debug_info = ''
         
     | 
| 
       289 
290 
     | 
    
         | 
| 
       290 
291 
     | 
    
         
             
                    begin
         
     | 
| 
       291 
292 
     | 
    
         
             
                      begin
         
     | 
| 
         @@ -306,12 +307,13 @@ module Jabber 
     | 
|
| 
       306 
307 
     | 
    
         
             
                          req_body += data unless restart
         
     | 
| 
       307 
308 
     | 
    
         
             
                          req_body += "</body>"
         
     | 
| 
       308 
309 
     | 
    
         
             
                          current_rid = @http_rid
         
     | 
| 
      
 310 
     | 
    
         
            +
                          debug_info = "sid=#{@http_sid} rid=#{current_rid}"
         
     | 
| 
       309 
311 
     | 
    
         | 
| 
       310 
312 
     | 
    
         
             
                          @pending_requests += 1
         
     | 
| 
       311 
313 
     | 
    
         
             
                          @last_send = Time.now
         
     | 
| 
       312 
314 
     | 
    
         
             
                        }
         
     | 
| 
       313 
315 
     | 
    
         | 
| 
       314 
     | 
    
         
            -
                        res_body = post(req_body)
         
     | 
| 
      
 316 
     | 
    
         
            +
                        res_body = post(req_body, debug_info)
         
     | 
| 
       315 
317 
     | 
    
         | 
| 
       316 
318 
     | 
    
         
             
                      ensure
         
     | 
| 
       317 
319 
     | 
    
         
             
                        @lock.synchronize {
         
     | 
| 
         @@ -329,18 +331,19 @@ module Jabber 
     | 
|
| 
       329 
331 
     | 
    
         
             
                          close; @exception_block.call(e, self, :parser)
         
     | 
| 
       330 
332 
     | 
    
         
             
                        end
         
     | 
| 
       331 
333 
     | 
    
         
             
                      else
         
     | 
| 
       332 
     | 
    
         
            -
                        Jabber::debuglog "Exception caught when parsing HTTP response!"
         
     | 
| 
      
 334 
     | 
    
         
            +
                        Jabber::debuglog "Exception caught when parsing HTTP response! (#{debug_info})"
         
     | 
| 
       333 
335 
     | 
    
         
             
                        close
         
     | 
| 
       334 
336 
     | 
    
         
             
                        raise
         
     | 
| 
       335 
337 
     | 
    
         
             
                      end
         
     | 
| 
       336 
338 
     | 
    
         | 
| 
       337 
339 
     | 
    
         
             
                    rescue StandardError => e
         
     | 
| 
       338 
     | 
    
         
            -
                      Jabber::debuglog("POST error (will retry): #{e.class}: #{e}")
         
     | 
| 
      
 340 
     | 
    
         
            +
                      Jabber::debuglog("POST error (will retry) #{debug_info}: #{e.class}: #{e}, #{e.backtrace}")
         
     | 
| 
       339 
341 
     | 
    
         
             
                      receive_elements_with_rid(current_rid, [])
         
     | 
| 
       340 
342 
     | 
    
         
             
                      # It's not good to resend on *any* exception,
         
     | 
| 
       341 
343 
     | 
    
         
             
                      # but there are too many cases (Timeout, 404, 502)
         
     | 
| 
       342 
344 
     | 
    
         
             
                      # where resending is appropriate
         
     | 
| 
       343 
345 
     | 
    
         
             
                      # TODO: recognize these conditions and act appropriate
         
     | 
| 
      
 346 
     | 
    
         
            +
                      # FIXME: resending the same data with a new rid is wrong.  should resend with the same rid
         
     | 
| 
       344 
347 
     | 
    
         
             
                      send_data(data)
         
     | 
| 
       345 
348 
     | 
    
         
             
                    end
         
     | 
| 
       346 
349 
     | 
    
         
             
                  end
         
     | 
    
        data/lib/xmpp4r/xmpp4r.rb
    CHANGED
    
    | 
         @@ -8,7 +8,7 @@ module Jabber 
     | 
|
| 
       8 
8 
     | 
    
         
             
              # XMPP4R Version number.  This is the ONLY place where the version number
         
     | 
| 
       9 
9 
     | 
    
         
             
              # should be specified.  This constant is used to determine the version of
         
     | 
| 
       10 
10 
     | 
    
         
             
              # package tarballs and generated gems.
         
     | 
| 
       11 
     | 
    
         
            -
              XMPP4R_VERSION = '0.6. 
     | 
| 
      
 11 
     | 
    
         
            +
              XMPP4R_VERSION = '0.6.2'
         
     | 
| 
       12 
12 
     | 
    
         
             
            end
         
     | 
| 
       13 
13 
     | 
    
         | 
| 
       14 
14 
     | 
    
         
             
            require 'xmpp4r/client'
         
     | 
    
        data/mad-p-xmpp4r.gemspec
    CHANGED
    
    
    
        data/test/ts_xmpp4r.rb
    CHANGED
    
    | 
         @@ -13,7 +13,16 @@ require 'find' 
     | 
|
| 
       13 
13 
     | 
    
         | 
| 
       14 
14 
     | 
    
         
             
            # List files' basenames, not full path!
         
     | 
| 
       15 
15 
     | 
    
         
             
            # EXCLUDED_FILES = [ 'tc_muc_simplemucclient.rb' ]
         
     | 
| 
       16 
     | 
    
         
            -
            EXCLUDED_FILES = [ 
     | 
| 
      
 16 
     | 
    
         
            +
            EXCLUDED_FILES = %w[
         
     | 
| 
      
 17 
     | 
    
         
            +
              tc_disconnect_cleanup.rb
         
     | 
| 
      
 18 
     | 
    
         
            +
              ./pubsub/tc_helper.rb
         
     | 
| 
      
 19 
     | 
    
         
            +
              ./muc/tc_muc_mucclient.rb
         
     | 
| 
      
 20 
     | 
    
         
            +
              ./reliable/tc_reliable_connection.rb
         
     | 
| 
      
 21 
     | 
    
         
            +
              ./reliable/tc_disconnect_exception.rb
         
     | 
| 
      
 22 
     | 
    
         
            +
              ./reliable/tc_listener_mocked_test.rb
         
     | 
| 
      
 23 
     | 
    
         
            +
              ./reliable/tc_reliable_connection.rb
         
     | 
| 
      
 24 
     | 
    
         
            +
              ./bytestreams/tc_socks5bytestreams.rb
         
     | 
| 
      
 25 
     | 
    
         
            +
            ].map {|f| f.gsub(%r[^\.], File.dirname(__FILE__)) }
         
     | 
| 
       17 
26 
     | 
    
         | 
| 
       18 
27 
     | 
    
         
             
            tc_files = []
         
     | 
| 
       19 
28 
     | 
    
         
             
            tc_subdirs = []
         
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: mad-p-xmpp4r
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 0.6. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.6.2
         
     | 
| 
       5 
5 
     | 
    
         
             
              prerelease: 
         
     | 
| 
       6 
6 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       7 
7 
     | 
    
         
             
            authors:
         
     | 
| 
         @@ -12,7 +12,7 @@ authors: 
     | 
|
| 
       12 
12 
     | 
    
         
             
            autorequire: 
         
     | 
| 
       13 
13 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       14 
14 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       15 
     | 
    
         
            -
            date: 2013-02- 
     | 
| 
      
 15 
     | 
    
         
            +
            date: 2013-02-26 00:00:00.000000000 Z
         
     | 
| 
       16 
16 
     | 
    
         
             
            dependencies: []
         
     | 
| 
       17 
17 
     | 
    
         
             
            description: This is a fork from XMPP4R (https://github.com/ln/xmpp4r), fixing BOSH
         
     | 
| 
       18 
18 
     | 
    
         
             
            email: kaoru.maeda@gmail.com
         
     |