Added XEP-0138 Stream Compression support to XMPPFramework #247

Closed
wants to merge 19 commits into
from

Conversation

Projects
None yet
7 participants
@sprhawk

sprhawk commented Sep 8, 2013

1. Separated XMPPStream internal Extension into the XMPPStreamInternal.h, which could be called from XMPPFeature;
2. Moved asyncSocket write/read data into a wrapper method -[XMPPStream write/readData ...], in which a registeredStreamPreprocessor could do preprocess (eg, XMPPCompression could deflate / inflate data);
3. Added XMPPFeature into calling procedure for XMPPStream;
4. Added XMPPCompression feature, which applies to XEP-0138 Stream Compression
5. Added XMPPCompression support into DesktopXMPP and iPhoneXMPP projects

Tested on OpenFire 3.8.2 and ejabbared 2.1.13

I accidently removed the branch and it caused this pull request closed. please add new comment to #563

sprhawk and others added some commits Jul 17, 2013

xmppRoster:didReceiveRosterPush: API
Sent when a Roster Push is received as specified in Section 2.1.6 of RFC 6121.
XEP-0045: added methods to XMPPMessage category to handle room subjec…
…ts, have XMPPRoom check incoming messages for room subjects and use them to set the roomSubject property
1. Separated XMPPStream internal Extension into the XMPPStreamInterna…
…l.h, which could be called from XMPPFeature;

2. Moved asyncSocket write/read data into a wrapper method -[XMPPStream write/readData ...], in which a registeredStreamPreprocessor could do preprocess (eg, XMPPCompression could deflate / inflate data);
3. Added XMPPFeature into calling procedure for XMPPStream;
4. Added XMPPCompression feature, which applies to XEP-0138 Stream Compression
5. Added XMPPCompression support into DesktopXMPP and iPhoneXMPP projects
optimized deflation ( one pass, one allocaing buffer )
optimized inflation ( try one pass, one allocating buffer )
@ObjColumnist

This comment has been minimized.

Show comment
Hide comment
@ObjColumnist

ObjColumnist Sep 8, 2013

Collaborator

Wow 👍

It is quite a big commit so il look over it before I merge it in.

Collaborator

ObjColumnist commented Sep 8, 2013

Wow 👍

It is quite a big commit so il look over it before I merge it in.

@sprhawk

This comment has been minimized.

Show comment
Hide comment
@sprhawk

sprhawk Sep 8, 2013

Yes, I don't want to insert an XEP-0138 into the core implementation of XMPPStream, but the feature that needs re-negotiation requires some functionality of XMPPStream, so I have to separate internal header of XMPPStream into an XMPPStreamInternal.h. other changes are not so big as such -- they are separated at least.

And I'll work for XEP-0198 Stream Management next week, wish it is not big as this one 😄

sprhawk commented Sep 8, 2013

Yes, I don't want to insert an XEP-0138 into the core implementation of XMPPStream, but the feature that needs re-negotiation requires some functionality of XMPPStream, so I have to separate internal header of XMPPStream into an XMPPStreamInternal.h. other changes are not so big as such -- they are separated at least.

And I'll work for XEP-0198 Stream Management next week, wish it is not big as this one 😄

@sprhawk

This comment has been minimized.

Show comment
Hide comment
@sprhawk

sprhawk Sep 8, 2013

BTW:
My hack into XMPPStream for XEP-0138 is just a workaround for now.

I added a feature array enumeration which is inserted before resource binding, because XEP-0138 recommends the negotiation is behind SASL but before resource binding, but if other feature as a "module" is to be added into the infrastructure of features like this, it may not work properly (due to the order is before resource binding)

sprhawk commented Sep 8, 2013

BTW:
My hack into XMPPStream for XEP-0138 is just a workaround for now.

I added a feature array enumeration which is inserted before resource binding, because XEP-0138 recommends the negotiation is behind SASL but before resource binding, but if other feature as a "module" is to be added into the infrastructure of features like this, it may not work properly (due to the order is before resource binding)

@sprhawk

This comment has been minimized.

Show comment
Hide comment
@sprhawk

sprhawk Sep 9, 2013

Sorry I deleted the branch by accident

sprhawk commented Sep 9, 2013

Sorry I deleted the branch by accident

@sprhawk sprhawk reopened this Sep 9, 2013

@ObjColumnist

This comment has been minimized.

Show comment
Hide comment
@ObjColumnist

ObjColumnist Sep 17, 2013

Collaborator

Hi,

I tested this and it works fine until it gets to my roster (which has around 100 hundred items), at this point the compression fails.

I am guessing this is because the compressed data is split across multiple data chunks.

Collaborator

ObjColumnist commented Sep 17, 2013

Hi,

I tested this and it works fine until it gets to my roster (which has around 100 hundred items), at this point the compression fails.

I am guessing this is because the compressed data is split across multiple data chunks.

@sprhawk

This comment has been minimized.

Show comment
Hide comment
@sprhawk

sprhawk Sep 29, 2013

@ObjColumnist I have no idea for now. I just follow the process of the XEP, it seems not provide any mechanism to handle it.
I'm working for other projects, currently I have no time to verify it.

sprhawk commented Sep 29, 2013

@ObjColumnist I have no idea for now. I just follow the process of the XEP, it seems not provide any mechanism to handle it.
I'm working for other projects, currently I have no time to verify it.

@ObjColumnist

This comment has been minimized.

Show comment
Hide comment
@ObjColumnist

ObjColumnist Sep 29, 2013

Collaborator

No problem 😄

Collaborator

ObjColumnist commented Sep 29, 2013

No problem 😄

@wujie0919

This comment has been minimized.

Show comment
Hide comment
@wujie0919

wujie0919 Oct 17, 2013

hello

When I use the XEP - 0138, Authenticate error “xmppStream:didNotAuthenticate:”, why?

hello

When I use the XEP - 0138, Authenticate error “xmppStream:didNotAuthenticate:”, why?

@sprhawk

This comment has been minimized.

Show comment
Hide comment
@sprhawk

sprhawk Oct 17, 2013

@wujie0919 ah oh, your description is too simple, i cannot explain. try to use with OpenFire and have a try again

sprhawk commented Oct 17, 2013

@wujie0919 ah oh, your description is too simple, i cannot explain. try to use with OpenFire and have a try again

@wujie0919

This comment has been minimized.

Show comment
Hide comment
@wujie0919

wujie0919 Oct 17, 2013

2013-10-17 21:51:28:123 XMPPStream[1281:1803] SEND:
2013-10-17 21:51:28:123 XMPPStream[1281:1803] SEND: <stream:stream xmlns='jabber:client' xmlns:stream='http://etherx.jabber.org/streams' version='1.0' to='xmpp.qingdao.qxun.org'>
2013-10-17 21:51:28:303 XMPPStream[1281:2713] RECV: <stream:stream xmlns:stream="http://etherx.jabber.org/streams" xmlns="jabber:client" from="xmpp.qingdao.qxun.org" id="662c9b7d" stream:lang="en" version="1.0"/>
2013-10-17 21:51:28:384 XMPPStream[1281:2713] RECV: <stream:features xmlns:stream="http://etherx.jabber.org/streams">DIGEST-MD5PLAINCRAM-MD5zlib/stream:features
2013-10-17 21:51:28:385 XMPPStream[1281:2713] Compression Method: zlib
2013-10-17 21:51:28:385 XMPPStream[1281:2713] SEND: zlib
2013-10-17 21:51:28:469 XMPPStream[1281:2713] RECV:
2013-10-17 21:51:28:470 XMPPStream[1281:2713] SEND: <stream:stream xmlns='jabber:client' xmlns:stream='http://etherx.jabber.org/streams' version='1.0' to='xmpp.qingdao.qxun.org'>
2013-10-17 21:51:28:470 XMPPStream[1281:2713] SEND: Compression Rate:79.3651%(100/126)
2013-10-17 21:51:28:552 XMPPStream[1281:1803] RECV: Compression Rate:58.8101%(257/437)
2013-10-17 21:51:28:553 XMPPStream[1281:1803] RECV: <stream:stream xmlns:stream="http://etherx.jabber.org/streams" xmlns="jabber:client" from="xmpp.qingdao.qxun.org" id="662c9b7d" stream:lang="en" version="1.0"/>
2013-10-17 21:51:28:553 XMPPStream[1281:1803] RECV: <stream:features xmlns:stream="http://etherx.jabber.org/streams">DIGEST-MD5PLAINCRAM-MD5/stream:features
2013-10-17 21:51:28:554 XMPPStream[1281:303] RosterController: xmppStreamDidConnect:
2013-10-17 21:51:28:554 XMPPStream[1281:303] SEND:
2013-10-17 21:51:28:554 XMPPStream[1281:303] SEND: Compression Rate:90.1408%(64/71)
2013-10-17 21:51:28:640 XMPPStream[1281:1803] RECV: Compression Rate:75.4386%(172/228)
2013-10-17 21:51:28:641 XMPPStream[1281:2713] RECV: cmVhbG09InhtcHAucWluZ2Rhby5xeHVuLm9yZyIsbm9uY2U9IjJIYnVydFhZaGtzTlRBYkswQWlkZXRQemhKU1ZZWXU1ak5kb3BydGIiLHFvcD0iYXV0aCIsY2hhcnNldD11dGYtOCxhbGdvcml0aG09bWQ1LXNlc3M=
2013-10-17 21:51:28:642 XMPPStream[1281:2713] SEND: dXNlcm5hbWU9InRlc3QwNSIscmVhbG09InhtcHAucWluZ2Rhby5xeHVuLm9yZyIsbm9uY2U9IjJIYnVydFhZaGtzTlRBYkswQWlkZXRQemhKU1ZZWXU1ak5kb3BydGIiLGNub25jZT0iNzQxNkI2NzctQ0MzNC00QjA1LTg0RTctQUI2NTMzMzNFOTRFIixuYz0wMDAwMDAwMSxxb3A9YXV0aCxkaWdlc3QtdXJpPSJ4bXBwL3htcHAucWluZ2Rhby5xeHVuLm9yZyIscmVzcG9uc2U9MDRkZjZmNjJkNTkyYWYwNzRkYWMyNmQwZDM3MjBjMTgsY2hhcnNldD11dGYtOA==
2013-10-17 21:51:28:642 XMPPStream[1281:2713] SEND: Compression Rate:62.4390%(256/410)
2013-10-17 21:51:59:332 XMPPStream[1281:180b] RECV: Compression Rate:45.7364%(59/129)
2013-10-17 21:51:59:333 XMPPStream[1281:180b] RECV:
2013-10-17 21:51:59:333 XMPPStream[1281:303] RosterController: xmppStream:didNotAuthenticate:

you can see the error message。i look forword to your anser。

2013-10-17 21:51:28:123 XMPPStream[1281:1803] SEND:
2013-10-17 21:51:28:123 XMPPStream[1281:1803] SEND: <stream:stream xmlns='jabber:client' xmlns:stream='http://etherx.jabber.org/streams' version='1.0' to='xmpp.qingdao.qxun.org'>
2013-10-17 21:51:28:303 XMPPStream[1281:2713] RECV: <stream:stream xmlns:stream="http://etherx.jabber.org/streams" xmlns="jabber:client" from="xmpp.qingdao.qxun.org" id="662c9b7d" stream:lang="en" version="1.0"/>
2013-10-17 21:51:28:384 XMPPStream[1281:2713] RECV: <stream:features xmlns:stream="http://etherx.jabber.org/streams">DIGEST-MD5PLAINCRAM-MD5zlib/stream:features
2013-10-17 21:51:28:385 XMPPStream[1281:2713] Compression Method: zlib
2013-10-17 21:51:28:385 XMPPStream[1281:2713] SEND: zlib
2013-10-17 21:51:28:469 XMPPStream[1281:2713] RECV:
2013-10-17 21:51:28:470 XMPPStream[1281:2713] SEND: <stream:stream xmlns='jabber:client' xmlns:stream='http://etherx.jabber.org/streams' version='1.0' to='xmpp.qingdao.qxun.org'>
2013-10-17 21:51:28:470 XMPPStream[1281:2713] SEND: Compression Rate:79.3651%(100/126)
2013-10-17 21:51:28:552 XMPPStream[1281:1803] RECV: Compression Rate:58.8101%(257/437)
2013-10-17 21:51:28:553 XMPPStream[1281:1803] RECV: <stream:stream xmlns:stream="http://etherx.jabber.org/streams" xmlns="jabber:client" from="xmpp.qingdao.qxun.org" id="662c9b7d" stream:lang="en" version="1.0"/>
2013-10-17 21:51:28:553 XMPPStream[1281:1803] RECV: <stream:features xmlns:stream="http://etherx.jabber.org/streams">DIGEST-MD5PLAINCRAM-MD5/stream:features
2013-10-17 21:51:28:554 XMPPStream[1281:303] RosterController: xmppStreamDidConnect:
2013-10-17 21:51:28:554 XMPPStream[1281:303] SEND:
2013-10-17 21:51:28:554 XMPPStream[1281:303] SEND: Compression Rate:90.1408%(64/71)
2013-10-17 21:51:28:640 XMPPStream[1281:1803] RECV: Compression Rate:75.4386%(172/228)
2013-10-17 21:51:28:641 XMPPStream[1281:2713] RECV: cmVhbG09InhtcHAucWluZ2Rhby5xeHVuLm9yZyIsbm9uY2U9IjJIYnVydFhZaGtzTlRBYkswQWlkZXRQemhKU1ZZWXU1ak5kb3BydGIiLHFvcD0iYXV0aCIsY2hhcnNldD11dGYtOCxhbGdvcml0aG09bWQ1LXNlc3M=
2013-10-17 21:51:28:642 XMPPStream[1281:2713] SEND: dXNlcm5hbWU9InRlc3QwNSIscmVhbG09InhtcHAucWluZ2Rhby5xeHVuLm9yZyIsbm9uY2U9IjJIYnVydFhZaGtzTlRBYkswQWlkZXRQemhKU1ZZWXU1ak5kb3BydGIiLGNub25jZT0iNzQxNkI2NzctQ0MzNC00QjA1LTg0RTctQUI2NTMzMzNFOTRFIixuYz0wMDAwMDAwMSxxb3A9YXV0aCxkaWdlc3QtdXJpPSJ4bXBwL3htcHAucWluZ2Rhby5xeHVuLm9yZyIscmVzcG9uc2U9MDRkZjZmNjJkNTkyYWYwNzRkYWMyNmQwZDM3MjBjMTgsY2hhcnNldD11dGYtOA==
2013-10-17 21:51:28:642 XMPPStream[1281:2713] SEND: Compression Rate:62.4390%(256/410)
2013-10-17 21:51:59:332 XMPPStream[1281:180b] RECV: Compression Rate:45.7364%(59/129)
2013-10-17 21:51:59:333 XMPPStream[1281:180b] RECV:
2013-10-17 21:51:59:333 XMPPStream[1281:303] RosterController: xmppStream:didNotAuthenticate:

you can see the error message。i look forword to your anser。

@sprhawk

This comment has been minimized.

Show comment
Hide comment
@sprhawk

sprhawk Oct 17, 2013

I'm not an expert on XMPP. you can turn off md5 and try again. I have no idea whether it is related to MD5

sprhawk commented Oct 17, 2013

I'm not an expert on XMPP. you can turn off md5 and try again. I have no idea whether it is related to MD5

@wujie0919

This comment has been minimized.

Show comment
Hide comment
@wujie0919

wujie0919 Oct 17, 2013

OK,Thank you all the same。

OK,Thank you all the same。

@sprhawk

This comment has been minimized.

Show comment
Hide comment
@sprhawk

sprhawk Nov 7, 2013

@ObjColumnist I come back.
I reviewed the XEP-0138,I found

    Example 7. Entity Closes Stream Because of a Processing Error
    <stream:error>
      <undefined-condition xmlns='urn:ietf:params:xml:ns:xmpp-streams'/>
      <failure xmlns='http://jabber.org/protocol/compress'>
        <processing-failed/>
      </failure>
    </stream:error>
    </stream:stream>

I do miss this implementation, and I will do it today.

sprhawk commented Nov 7, 2013

@ObjColumnist I come back.
I reviewed the XEP-0138,I found

    Example 7. Entity Closes Stream Because of a Processing Error
    <stream:error>
      <undefined-condition xmlns='urn:ietf:params:xml:ns:xmpp-streams'/>
      <failure xmlns='http://jabber.org/protocol/compress'>
        <processing-failed/>
      </failure>
    </stream:error>
    </stream:stream>

I do miss this implementation, and I will do it today.

@sprhawk sprhawk closed this Nov 7, 2013

@sprhawk sprhawk deleted the sprhawk:compression branch Nov 7, 2013

@sprhawk sprhawk reopened this Nov 7, 2013

@sprhawk

This comment has been minimized.

Show comment
Hide comment
@sprhawk

sprhawk Nov 7, 2013

@ObjColumnist I added stream:error handling and compression failure handling into recently commits; and fixed a bug of features handling order as @wujie0919 mentioned.

But I did not verify the error handling, it still needs some tests.

sprhawk commented Nov 7, 2013

@ObjColumnist I added stream:error handling and compression failure handling into recently commits; and fixed a bug of features handling order as @wujie0919 mentioned.

But I did not verify the error handling, it still needs some tests.

@goodleixiao

This comment has been minimized.

Show comment
Hide comment
@goodleixiao

goodleixiao Feb 18, 2014

data: bc98cb4a c3401486 5f457d81 cc64a6b9 80b7953b ddb8902e d32e4a83 1a69ad74 a9858a8b 2254f106 8282500a 15445c08 2db52f93 09cd5b38 934ce365 2626adc6 1042b239 9939ffb9 7c674437 fc095155 9c608ce2 5bb643b8 875137a6 36015efd e64d4630 4b0b9417 6b856ab1 52dedb0f e6d48243 07392990 71330290 1978825f 56613be2 abe89591 97ca014c c66729f1 4b8a56ec d7e9d04a 4a6f5c97 789fa1a9 7c566249 b1cc27b6 4525fc8c f724123c 495e7b64 d01f9ff6 fcc683d7 e892f38e 3bbcf719 701c8f47 6dc1cba9 cbb87433 1019baaa 41dd44aa 69ae9477 e854b0ee 942aca81 aa14e940 a3ccab18 1b75f6b0 80059214 ddaad965 6b37f881 54dc8dba 6dd76d99 c4400339 b9cc202b 7101a2ad 15e26cc4 e5c64571 437e9c5d 45e9aac3 660c11cd 072d07c3 66fc5529 9026f748 f3c46b5e 90518b74 cebca3ae 4c27d2ba 72fb8f09 09a91b59 6906814e 69346542 b2ee1169 b696ac19 371ea399 01130b1c f87d8113 f68e0002 1f1765ee d90ab860 46d8a53b 389c362a 13d6c6a3 520326c0 9329e167 87e59dbc 039902b2 e0bc1ed1 5be63d7f d0f6df6e bce7bb39 77f8e2dd 76bdcba7 9800451a 4556ba1e 35bba202 31e3f5a9 02547aec 11981144 daacd2eb 1fe3f0f3 21c43b00 0000ffff ac58cb4e c24014fd 23f11557 8d89d185 1b13576e 0d4124dd a05148d4 15c8438a 92828828 3e22bec0 a4b48922 69a8c8c7 3877dafe 85773aa1 161f8d31 76d3b473 ef9d999c d3e939f7 c726c4c2 f6a2d363 9c093972 cf956d7e 8dc77fd1 3b7c06a7 ff312df0 3570e5c9 95a8bb2a 4726e3e5 d70b1502 def08f5c 6e31f516 9cf5d04a 822a7902 b95a761f e7c29ba1 a1507aa2 41a66916 53f67516 cf56b396 b62e0ba4 7f619f3e 307f5aee 5875e649 69be623d a7cd9664 ef955880 5e837c9d e85da227 48af8c59 b4d28662 0e23cd76 03b42cb3 a1b735c8 a470c834 5e708827 d2f30226 da6759b4 7d6f895d b480567f 8fe64a20 6ba05ed2 6a8774b3 56e386af 8d87819c 874c8756 ab6819a1 55848c02 b2ceca2a 0ace4ea5 7dc83729 aeb093a3 490d6b7a 36efecf6 63f3bfb5 953b0868 24125fe3 e3cb22ba 95711421 1368fbd1 bf4cb22f f36b4d61 211c8d33 c7e6dc85 79c66644 89d71002 83676129 bc21ae8a 21c73d38 be047fc0 5fde0d45 cdf226ef 34bcaaa4 5fb7d45b 4b4b0ee7 0c228400 67d5f7dc 9afa33b7 5cbf3e30 ebbef442 3889a1d0 b44c9547 2a95edc4 15279ccb 304e0524 16a351e1 0951673c 503586ba cc7af0f4 5c228641 7a15f3b8 64575538 3c20bdbe 79d4649a 53555900 6a4e5923 c69d5d93 311de482 7d9f338d 533ef5bf 9020862a 714b0cc6 900ab178 30ba1217 47d6a391 9f911ffd 8cbca780 1ffc63bf 85df1ff2 80f76cf1 1e89ef00 0000ffff
2014-02-17 09:52:15:256 ChatTest[1753:4503] Inflation failed: -3(invalid code lengths set)

data: bc98cb4a c3401486 5f457d81 cc64a6b9 80b7953b ddb8902e d32e4a83 1a69ad74 a9858a8b 2254f106 8282500a 15445c08 2db52f93 09cd5b38 934ce365 2626adc6 1042b239 9939ffb9 7c674437 fc095155 9c608ce2 5bb643b8 875137a6 36015efd e64d4630 4b0b9417 6b856ab1 52dedb0f e6d48243 07392990 71330290 1978825f 56613be2 abe89591 97ca014c c66729f1 4b8a56ec d7e9d04a 4a6f5c97 789fa1a9 7c566249 b1cc27b6 4525fc8c f724123c 495e7b64 d01f9ff6 fcc683d7 e892f38e 3bbcf719 701c8f47 6dc1cba9 cbb87433 1019baaa 41dd44aa 69ae9477 e854b0ee 942aca81 aa14e940 a3ccab18 1b75f6b0 80059214 ddaad965 6b37f881 54dc8dba 6dd76d99 c4400339 b9cc202b 7101a2ad 15e26cc4 e5c64571 437e9c5d 45e9aac3 660c11cd 072d07c3 66fc5529 9026f748 f3c46b5e 90518b74 cebca3ae 4c27d2ba 72fb8f09 09a91b59 6906814e 69346542 b2ee1169 b696ac19 371ea399 01130b1c f87d8113 f68e0002 1f1765ee d90ab860 46d8a53b 389c362a 13d6c6a3 520326c0 9329e167 87e59dbc 039902b2 e0bc1ed1 5be63d7f d0f6df6e bce7bb39 77f8e2dd 76bdcba7 9800451a 4556ba1e 35bba202 31e3f5a9 02547aec 11981144 daacd2eb 1fe3f0f3 21c43b00 0000ffff ac58cb4e c24014fd 23f11557 8d89d185 1b13576e 0d4124dd a05148d4 15c8438a 92828828 3e22bec0 a4b48922 69a8c8c7 3877dafe 85773aa1 161f8d31 76d3b473 ef9d999c d3e939f7 c726c4c2 f6a2d363 9c093972 cf956d7e 8dc77fd1 3b7c06a7 ff312df0 3570e5c9 95a8bb2a 4726e3e5 d70b1502 def08f5c 6e31f516 9cf5d04a 822a7902 b95a761f e7c29ba1 a1507aa2 41a66916 53f67516 cf56b396 b62e0ba4 7f619f3e 307f5aee 5875e649 69be623d a7cd9664 ef955880 5e837c9d e85da227 48af8c59 b4d28662 0e23cd76 03b42cb3 a1b735c8 a470c834 5e708827 d2f30226 da6759b4 7d6f895d b480567f 8fe64a20 6ba05ed2 6a8774b3 56e386af 8d87819c 874c8756 ab6819a1 55848c02 b2ceca2a 0ace4ea5 7dc83729 aeb093a3 490d6b7a 36efecf6 63f3bfb5 953b0868 24125fe3 e3cb22ba 95711421 1368fbd1 bf4cb22f f36b4d61 211c8d33 c7e6dc85 79c66644 89d71002 83676129 bc21ae8a 21c73d38 be047fc0 5fde0d45 cdf226ef 34bcaaa4 5fb7d45b 4b4b0ee7 0c228400 67d5f7dc 9afa33b7 5cbf3e30 ebbef442 3889a1d0 b44c9547 2a95edc4 15279ccb 304e0524 16a351e1 0951673c 503586ba cc7af0f4 5c228641 7a15f3b8 64575538 3c20bdbe 79d4649a 53555900 6a4e5923 c69d5d93 311de482 7d9f338d 533ef5bf 9020862a 714b0cc6 900ab178 30ba1217 47d6a391 9f911ffd 8cbca780 1ffc63bf 85df1ff2 80f76cf1 1e89ef00 0000ffff
2014-02-17 09:52:15:256 ChatTest[1753:4503] Inflation failed: -3(invalid code lengths set)

@wujie0919

This comment has been minimized.

Show comment
Hide comment
@wujie0919

wujie0919 Apr 24, 2014

I have encountered a problem that when I have sent serveral messages continuously,one another unable to received any information.

But when reply you by the other end or iq ping each other,the other end could receive a message that previously cannot received.

Hope you reply

I have encountered a problem that when I have sent serveral messages continuously,one another unable to received any information.

But when reply you by the other end or iq ping each other,the other end could receive a message that previously cannot received.

Hope you reply

@sprhawk

This comment has been minimized.

Show comment
Hide comment
@sprhawk

sprhawk Apr 24, 2014

@wujie0919 I don't think I find any method in the extension specification to recover the corrupted compressed data stream. Who can give a hint about it.

sprhawk commented Apr 24, 2014

@wujie0919 I don't think I find any method in the extension specification to recover the corrupted compressed data stream. Who can give a hint about it.

@am33t

This comment has been minimized.

Show comment
Hide comment
@am33t

am33t Jun 26, 2015

I have identified 2 problems here.
First, Inflation failed: -3(invalid code lengths set) OR -3(invalid distance too far back)
you get this error because the packet size to be decompressed is over 1024. You can fix this by increasing size of buffer
Bytef output[4096]; //Method processInputData:
but, this will still happen if packet size is over 4096

Second, because of first error, method "processInputData:" doesn't give proper uncompressed data. This is why xml packet parser fails to parse and disconnects XMPP.

After this XMPPCompression does send stream error and ends streams but continues sending compressed packets. Session cant be created because server is expecting uncompressed data but client is sending compressed data. And server keeps on sending XML error. (xml-not-well-formed)

thanks

am33t commented Jun 26, 2015

I have identified 2 problems here.
First, Inflation failed: -3(invalid code lengths set) OR -3(invalid distance too far back)
you get this error because the packet size to be decompressed is over 1024. You can fix this by increasing size of buffer
Bytef output[4096]; //Method processInputData:
but, this will still happen if packet size is over 4096

Second, because of first error, method "processInputData:" doesn't give proper uncompressed data. This is why xml packet parser fails to parse and disconnects XMPP.

After this XMPPCompression does send stream error and ends streams but continues sending compressed packets. Session cant be created because server is expecting uncompressed data but client is sending compressed data. And server keeps on sending XML error. (xml-not-well-formed)

thanks

@sprhawk sprhawk closed this Jul 18, 2015

@sprhawk

This comment has been minimized.

Show comment
Hide comment
@sprhawk

sprhawk Jul 18, 2015

@am33t Thank you for your comments. I was not focused on this stuff for a long time.

I may have found the problem : that is

offset += blockSz; 

in processInputData method, changed with:

_inflation_strm.total_in - old_total_in;

sprhawk commented Jul 18, 2015

@am33t Thank you for your comments. I was not focused on this stuff for a long time.

I may have found the problem : that is

offset += blockSz; 

in processInputData method, changed with:

_inflation_strm.total_in - old_total_in;
@sprhawk

This comment has been minimized.

Show comment
Hide comment
@sprhawk

sprhawk Jul 18, 2015

I accidently removed the branch and it caused this pull request closed. please add new comment to #563

sprhawk commented Jul 18, 2015

I accidently removed the branch and it caused this pull request closed. please add new comment to #563

@sprhawk

This comment has been minimized.

Show comment
Hide comment
@sprhawk

sprhawk Jul 18, 2015

@wujie0919 you can try the new commits if you have spare time

sprhawk commented Jul 18, 2015

@wujie0919 you can try the new commits if you have spare time

@sprhawk

This comment has been minimized.

Show comment
Hide comment
@sprhawk

sprhawk Jul 18, 2015

@goodleixiao please try the new commits from my own repo

sprhawk commented Jul 18, 2015

@goodleixiao please try the new commits from my own repo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment