%ents; ]>
Stream Compression This document defines an XMPP extension for negotiating compression of XML streams. &LEGALNOTICE; 0138 Draft Standards Track Standards JIG XMPP Core compress feature http://jabber.org/protocol/compress/feature.xsd compress http://jabber.org/protocol/compress/compress.xsd &hildjj; &stpeter; 1.2 in progress psa Per list discussion, clarified exactly when compression shall be considered to start. 1.1 2005-12-14 psa More completely specified error handling; mentioned LZW (DCLZ) method. 1.0 2005-06-16 psa Per a vote of the Jabber Council, advanced status to Draft. 0.5 2005-05-18 psa Modifications to address Council feedback: used RFC 3920 terminology; specified error conditions; specified ZLIB as mandatory to implement. 0.4 2005-05-11 psa Corrected several errors in the schemas. 0.3 2005-03-28 psa Specified compression methods registry. 0.2 2004-09-28 psa Fixed TLS text per list discussion. 0.1 2004-07-16 jjh/psa Initial version.

&xmppcore; specifies the use of Transport Layer Security (TLS; see &rfc2246;) for encryption of XML streams, and TLS includes the ability to compress encrypted traffic (see &rfc3749;). However, not all computing platforms are able to implement TLS, and traffic compression may be desirable for communication by applications on such computing platforms. This JEP defines a mechanism for negotiating the compression of XML streams outside the context of TLS.

The protocol flow is as follows:

zlib lzw ]]>

Note: The <compression/> element MUST contain at least one <method/> child element. Each <method/> element MUST contain XML character data that specifies the name of a compression method, and such method names SHOULD be registered as described in the Compression Methods Registry section of this document. The methods SHOULD be provided in order of preference.

The initiating entity then MAY request compression by specifying one of the methods advertised by the receiving entity:

zlib ]]>

Note: If the initiating entity did not understand any of the advertised compression methods, it SHOULD ignore the compression option and proceed as if no compression methods were advertised.

If the initiating entity requests a stream compression method that is not supported by the receiving entity, the receiving entity MUST return an <unsupported-method/> error:

]]>

If the receiving entity finds the requested method unacceptable or unworkable for any other reason, it MUST return a <setup-failed/> error:

]]>

Note: Failure of the negotiation SHOULD NOT be treated as an unrecoverable error and therefore SHOULD NOT result in a stream error. In particular, the initiating entity is free to retry the compression negotiation if it fails.

If no error occurs, the receiving entity MUST inform the initiating entity that compression has been successfully negotiated:

]]>

Both entities MUST now consider the previous (uncompressed) stream to be null and void, just as with TLS negotiation and SASL negotiation (as specified in RFC 3920) and MUST begin compressed communications with a new (compressed) stream. Therefore the initiating entity MUST initiate a new stream to the receiving entity:

]]>

If compression processing fails after the new (compressed) stream has been established, the entity that detects the error SHOULD generate a stream error and close the stream:

]]>

The following business rules apply:

A compliant implementation MUST implement the ZLIB compression method as specified in &rfc1950;. All other methods are OPTIONAL; such methods may be defined in future JEPs or by registration as described in the Compression Methods Registry section of this document.

When using ZLIB for compression, the sending application SHOULD complete a partial flush of ZLIB when its current send is complete. Note that this statement is deliberately somewhat vague: the sending application may end up performing this partial flush after sending every XML stanza, but on the other hand may perform the partial flush only after sending a group of stanzas that have been queued up for delivery. When to flush the state of the compression application is up to the sending application.

The "LZW" compression algorithm was originally developed by Abraham Lempel and Jacob Ziv, subsequently improved by Terry Welch See "A Technique for High-Performance Data Compression", Computer (June 1984), pp. 8-19., and patented by Sperry Corporation (later Unisys Corporation) as U.S. Patent Number 4,464,650 See <http://patft.uspto.gov/netacgi/nph-Parser?patentnumber=4,464,650>.. This patent expired on June 20, 2003 See <http://www.unisys.com/about__unisys/lzw>. and therefore implementations are no longer patent-encumbered. If this algorithm is supported, implementations SHOULD follow the specification provided by Ecma International in &ecma151; under the name "DCLZ".

Stream encryption via TLS (as defined in RFC 3920) and stream compression (as defined herein) are not mutually exclusive, but stream encryption via TLS MUST be negotiated before negotiation of stream compression in order to secure the stream.

This JEP requires no interaction with &IANA;.

The ®ISTRAR; includes 'http://jabber.org/features/compress' in its registry of stream features.

The Jabber Registrar includes 'http://jabber.org/protocol/compress' in its registry of protocol namespaces.

The Jabber Registrar maintains a registry of compression methods at <http://www.jabber.org/registrar/compress.html>.

®PROCESS; the XML character data of the method element a natural-language description of the compression method the document that specifies or registers the compression method ]]>

The registrant may register more than one compression method at a time, each contained in a separate <method/> element.

lzw the LZW (DCLZ) compression method ECMA-151 zlib the ZLIB compression method RFC 1950 ]]>
The protocol documented by this schema is defined in JEP-0138: http://www.jabber.org/jeps/jep-0138.html ]]> The protocol documented by this schema is defined in JEP-0138: http://www.jabber.org/jeps/jep-0138.html ]]>