Network Working Group                                   Arnt Gulbrandsen
Request for Comments: DRAFT                       Oryx Mail Systems GmbH
draft-gulbrandsen-imap-deflate-00.txt                     September 2003


                  The IMAP COMPRESS=DEFLATE extension


Status of this Memo

    This document is an Internet-Draft and is in full conformance with
    all provisions of Section 10 of RFC2026.  Internet-Drafts are
    working documents of the Internet Engineering Task Force (IETF), its
    areas, and its working groups.  Note that other groups may also
    distribute working documents as Internet-Drafts.

    Internet-Drafts are draft documents valid for a maximum of six
    months and may be updated, replaced, or obsoleted by other documents
    at any time.  It is inappropriate to use Internet-Drafts as
    reference material or to cite them other than as "work in progress".

    The list of current Internet-Drafts can be accessed at
    http://www.ietf.org/ietf/1id-abstracts.txt.  The list of Internet-
    Draft Shadow Directories can be accessed at
    http://www.ietf.org/shadow.html.


Copyright Notice

    Copyright (C) The Internet Society 2003.  All Rights Reserved.


Abstract

    The COMPRESS=DEFLATE extension allows an IMAP connection to be
    compressed using the DEFLATE algorithm, such that effective
    compression is available even when TLS is used.


Conventions Used in This Document

    The key words "REQUIRED", "MUST", "MUST NOT", "SHOULD", "SHOULD
    NOT", and "MAY" in this document are to be interpreted as described
    in "Key words for use in RFCs to Indicate Requirement Levels"
    [KEYWORDS]. Formal syntax is defined by [ABNF] as modified by
    [IMAP].





Gulbrandsen                Expires March 2004                   [Page 1]


Internet-draft                                            September 2003


    In the example, "C:" and "S:" indicate lines sent by the client and
    server respectively.


Introduction and Overview

    An IMAP server that supports this extension announces
    "COMPRESS=DEFLATE" as one of its capabilities.

    The goal of COMPRESS=DEFLATE is to reduce the bandwidth usage of
    IMAP.  On regular IMAP connections, the PPP or MNP compression used
    with many low-bandwidth links compresses IMAP well. However, when
    TLS is used, PPP/MNP compression is ineffective. TLS too may provide
    compression, but for patent reasons few or no implementations do so
    in practice.

    In order to increase interoperation, it is desirable to have as few
    different compression algorithms as possible, so this document
    specifies only one.  The DEFLATE algorithm is standard, widely
    available, unencumbered by patents and fairly efficient.  Hopefully
    it will not be necessary to define additional algorithms.

    The extension adds one new command (COMPRESS) and no new responses.


The COMPRESS Command

    Arguments: Name of compression mechanism: "DEFLATE".

    Responses: None

    Result: OK    The server will compress its responses and expects the
                  client to compress its commands.
            NO    The connection already is compressed, or the server doesn't
                  support the requested mechanism.
            BAD   Command unknown or invalid argument.

    The COMPRESS command instructs the server to use the named
    compression mechanism ("DEFLATE" is the only one defined) for future
    commands and responses.

    For DEFLATE (as for many other compression mechanisms), the
    compressor can trade speed against quality.  When decompressing
    there isn't much of a tradeoff.  Consequently, the client and server
    are both free to pick the best reasonable rate of compression for
    the data they send.





Gulbrandsen                Expires March 2004                   [Page 2]


Internet-draft                                            September 2003


    The client MUST NOT send additional commands until it has seen the
    result of COMPRESS.

    If the client wants to use both TLS and compression, it SHOULD send
    STARTTLS before COMPRESS.


Example

    This example shows a simple login sequence. The client uses TLS for
    privacy and DEFLATE for compression.

         S: * OK [CAPABILITY IMAP4REV1 STARTTLS COMPRESS=DEFLATE]
         C: a starttls
         S: a OK
         C: b compress deflate
         S: b OK
         C: c login arnt tnra
         S: c OK


Implementation Notes

    When using the zlib library (see [DEFLATE]), the functions
    deflateInit(), deflate(), inflateInit() and inflate() suffice to
    implement this extension.

    Note that when using TLS, compression may actually decrease the CPU
    usage, depending on which algorithms are used in TLS. This is
    because fewer bytes need to be encrypted, and encryption is
    generally more expensive than compression.


Formal Syntax

    The following syntax specification uses the Augmented Backus-Naur
    Form (ABNF) notation as specified in [ABNF]. Non-terminals
    referenced but not defined below are as defined by [ABNF] (SP, CRLF)
    or [IMAP] (all others).

    Except as noted otherwise, all alphabetic characters are case-
    insensitive.  The use of upper or lower case characters to define
    token strings is for editorial clarity only.  Implementations MUST
    accept these strings in a case-insensitive fashion.

        command-any =/ compress
        compress    = "COMPRESS" SP astring




Gulbrandsen                Expires March 2004                   [Page 3]


Internet-draft                                            September 2003


Security considerations

    The proposed extension does not cause any security problems. It may
    marginally reduce the scope for plaintext attacks when used together
    with [TLS].


Credits

    (Your name here :)


References

    [ABNF]     Crocker, Overell, "Augmented BNF for Syntax
               Specifications: ABNF", RFC 2234, Internet Mail
               Consortium, Demon Internet Ltd, November 1997.

    [IMAP]     Crispin, M., "Internet Message Access Protocol - Version
               4rev1", RFC 3501, University of Washington, June 2003.

    [KEYWORDS] Bradner, "Key words for use in RFCs to Indicate
               Requirement Levels", RFC 2119, Harvard University, March
               1997.

    [DEFLATE]  Deutsch, P., "DEFLATE Compressed Data Format
               Specification version 1.3", RFC 1951, Aladdin
               Enterprises, May 1996.

    [STARTTLS] Newman, C. "Using TLS with IMAP, POP3 and ACAP", RFC
               2595, June 1999.


Author's Address:

    Arnt Gulbrandsen
    Oryx Mail Systems GmbH
    Joseph-Dollinger-Bogen 14
    D-80807 Muenchen
    Germany

    Phone: +49 89 32356-401
    Fax: +49 89 32356-409

    Email: arnt@oryx.com






Gulbrandsen                Expires March 2004                   [Page 4]