%ents; ]>
Stream Compression This document defines an XMPP protocol extension for negotiating compression of XML streams, especially in situations where standard TLS compression cannot be negotiated. The protocol provides a modular framework that can accommodate a wide range of compression algorithms; the ZLIB compression algorithm is mandatory-to-implement, but implementations may support other algorithms in addition. &LEGALNOTICE; 0138 Final Standards Track Standards XMPP Core compress compress http://www.xmpp.org/schemas/compress.xsd feature http://www.xmpp.org/schemas/compress-feature.xsd &hildjj; &stpeter; 2.0 2009-05-27 psa

Per a vote of the XMPP Council, advanced status to Final.

1.3 2007-09-26 psa

Moved specification of LZW algorithm to XEP-0229.

1.2 2007-08-22 psa

Clarified when compression shall be considered to start; per XEP-0170, specified that compression should be negotiated after SASL.

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 &rfc4346;) 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 document 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:

Support for the ZLIB compression method as specified in &rfc1950; is REQUIRED.

All other methods are OPTIONAL; such methods may be defined in future specifications or by registration as described in the Compression Methods Registry section of this document.

Implementations MAY support the following methods in addition to ZLIB:

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.

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 document requires no interaction with &IANA;.

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

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

The XMPP Registrar maintains a registry of compression methods at &COMPRESSMETHODS;.

®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.

zlib the ZLIB compression method RFC 1950 ]]>
The protocol documented by this schema is defined in XEP-0138: http://www.xmpp.org/extensions/xep-0138.html ]]> The protocol documented by this schema is defined in XEP-0138: http://www.xmpp.org/extensions/xep-0138.html ]]>