This JEP defines a mechanism for compressing XML streams.
WARNING: This Standards-Track JEP is Experimental. Publication as a Jabber Enhancement Proposal does not imply approval of this proposal by the Jabber Software Foundation. Implementation of the protocol described herein is encouraged in exploratory implementations, but production systems should not deploy implementations of this protocol until it advances to a status of Draft.
Type: Standards Track
Last Updated: 2004-09-28
JIG: Standards JIG
Approving Body: Jabber Council
Dependencies: XMPP Core
Superseded By: None
Short Name: compress
This Jabber Enhancement Proposal is copyright 1999 - 2004 by the Jabber Software Foundation (JSF) and is in full conformance with the JSF's Intellectual Property Rights Policy <http://www.jabber.org/jsf/ipr-policy.php>. This material may be distributed only subject to the terms and conditions set forth in the Open Publication License, v1.0 or later (the latest version is presently available at <http://www.opencontent.org/openpub/>).
The preferred venue for discussion of this document is the Standards-JIG discussion list: <http://mail.jabber.org/mailman/listinfo/standards-jig>.
The Extensible Messaging and Presence Protocol (XMPP) is defined in the XMPP Core and XMPP IM specifications contributed by the Jabber Software Foundation to the Internet Standards Process, which is managed by the Internet Engineering Task Force in accordance with RFC 2026. Any protocols defined in this JEP have been developed outside the Internet Standards Process and are to be understood as extensions to XMPP rather than as an evolution, development, or modification of XMPP itself.
The keywords "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in RFC 2119.
XMPP Core  specifies the use of Transport Layer Security (see RFC 2246 ) for encryption of XML streams, and TLS includes the ability to compress encrypted traffic (see RFC 3749 ). However, not all devices are able to implement TLS, and traffic compression may be desirable for communication by such devices. This JEP defines a mechanism for compressing XML streams outside the context of TLS. Such compression could be performed using any number of compression methods, but the only method required by this JEP is ZLIB as specified in RFC 1950 .
The protocol flow is as follows:
<stream:features> <starttls xmlns='urn:ietf:params:xml:ns:xmpp-tls'/> <compression xmlns='http://jabber.org/features/compress'> <method>zlib</method> </compression> </stream:features>
<compress xmlns='http://jabber.org/protocol/compress'> <method>zlib</method> </compress>
Both entities MUST now consider the previous stream to be null and void, just as with TLS negotiation and SASL negotiation (as specified in XMPP Core). Therefore the client MUST initiate a new stream to the server:
<stream:stream xmlns='jabber:client' xmlns:stream='http://etherx.jabber.org/streams' to='shakespeare.lit'>
Note well the following:
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 XMPP Core) 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 the Internet Assigned Numbers Authority (IANA) .
Upon approval of this JEP, the Jabber Registrar shall add 'http://jabber.org/features/compress' to its registry of stream features.
Upon advancement of this JEP to a status of Draft, the Jabber Registrar  shall add 'http://jabber.org/protocol/compress' to its registry of protocol namespaces.
<?xml version='1.0' encoding='UTF-8'?> <xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema' targetNamespace='http://jabber.org/features/compress' xmlns='http://jabber.org/features/compress' elementFormDefault='qualified'> <xs:element name='compression'/> <xs:complexType> <xs:sequence> <xs:element ref='method' minOccurs='0' maxOccurs='unbounded'/> </xs:sequence> </xs:complexType> </xs:element> <xs:element name='method' type='xs:string'/> </xs:schema>
<?xml version='1.0' encoding='UTF-8'?> <xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema' targetNamespace='http://jabber.org/protocol/compress' xmlns='http://jabber.org/protocol/compress' elementFormDefault='qualified'> <xs:element name='compress' type='empty'/> <xs:element name='compressed' type='empty'/> <xs:simpleType name='empty'> <xs:restriction base='xs:string'> <xs:enumeration value=''/> </xs:restriction> </xs:simpleType> </xs:schema>
1. RFC 3920: Extensible Messaging and Presence Protocol (XMPP): Core <http://www.ietf.org/rfc/rfc3920.txt>.
2. RFC 2246: The TLS Protocol Version 1.0 <http://www.ietf.org/rfc/rfc2246.txt>.
3. RFC 3749: Transport Layer Security Protocol Compression Methods <http://www.ietf.org/rfc/rfc3749.txt>.
4. RFC 1950: ZLIB Compressed Data Format Specification version 3.3 <http://www.ietf.org/rfc/rfc1950.txt>.
5. The Internet Assigned Numbers Authority (IANA) is the central coordinator for the assignment of unique parameter values for Internet protocols, such as port numbers and URI schemes. For further information, see <http://www.iana.org/>.
6. The Jabber Registrar maintains a list of reserved Jabber protocol namespaces as well as registries of parameters used in the context of protocols approved by the Jabber Software Foundation. For further information, see <http://www.jabber.org/registrar/>.