draft-ietf-hybi-permessage-compression-03.txt   draft-ietf-hybi-permessage-compression-04.txt 
HyBi Working Group T. Yoshino HyBi Working Group T. Yoshino
Internet-Draft Google, Inc. Internet-Draft Google, Inc.
Intended status: Standards Track October 16, 2012 Intended status: Standards Track October 19, 2012
Expires: April 19, 2013 Expires: April 22, 2013
WebSocket Per-message Compression WebSocket Per-message Compression
draft-ietf-hybi-permessage-compression-03 draft-ietf-hybi-permessage-compression-04
Abstract Abstract
This specification defines a WebSocket extension that adds This specification defines a WebSocket extension that adds
compression functionality to the WebSocket Protocol. It compresses compression functionality to the WebSocket Protocol. It compresses
the payload of non-control WebSocket messages using specified the payload of non-control WebSocket messages using specified
compression algorithm. One reserved bit RSV1 in the WebSocket frame compression algorithm. One reserved bit RSV1 in the WebSocket frame
header is allocated to control application of compression for each header is allocated to control application of compression for each
message. This specification provides one compression method message. This specification provides one compression method
available for the extension using DEFLATE. available for the extension using DEFLATE.
skipping to change at page 1, line 38 skipping to change at page 1, line 38
Internet-Drafts are working documents of the Internet Engineering Internet-Drafts are working documents of the Internet Engineering
Task Force (IETF). Note that other groups may also distribute Task Force (IETF). Note that other groups may also distribute
working documents as Internet-Drafts. The list of current Internet- working documents as Internet-Drafts. The list of current Internet-
Drafts is at http://datatracker.ietf.org/drafts/current. Drafts is at http://datatracker.ietf.org/drafts/current.
Internet-Drafts are draft documents valid for a maximum of six months Internet-Drafts are draft documents valid for a maximum of six months
and may be updated, replaced, or obsoleted by other documents at any and may be updated, replaced, or obsoleted by other documents at any
time. It is inappropriate to use Internet-Drafts as reference time. It is inappropriate to use Internet-Drafts as reference
material or to cite them other than as "work in progress." material or to cite them other than as "work in progress."
This Internet-Draft will expire on April 19, 2013. This Internet-Draft will expire on April 22, 2013.
Copyright Notice Copyright Notice
Copyright (c) 2012 IETF Trust and the persons identified as the Copyright (c) 2012 IETF Trust and the persons identified as the
document authors. All rights reserved. document authors. All rights reserved.
This document is subject to BCP 78 and the IETF Trust's Legal This document is subject to BCP 78 and the IETF Trust's Legal
Provisions Relating to IETF Documents Provisions Relating to IETF Documents
(http://trustee.ietf.org/license-info) in effect on the date of (http://trustee.ietf.org/license-info) in effect on the date of
publication of this document. Please review these documents publication of this document. Please review these documents
skipping to change at page 2, line 22 skipping to change at page 2, line 22
2. Conformance Requirements . . . . . . . . . . . . . . . . . . . 4 2. Conformance Requirements . . . . . . . . . . . . . . . . . . . 4
3. Extension Negotiation . . . . . . . . . . . . . . . . . . . . 5 3. Extension Negotiation . . . . . . . . . . . . . . . . . . . . 5
3.1. Negotiation Example . . . . . . . . . . . . . . . . . . . 6 3.1. Negotiation Example . . . . . . . . . . . . . . . . . . . 6
4. Framing . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 4. Framing . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
4.1. Sending . . . . . . . . . . . . . . . . . . . . . . . . . 7 4.1. Sending . . . . . . . . . . . . . . . . . . . . . . . . . 7
4.2. Receiving . . . . . . . . . . . . . . . . . . . . . . . . 7 4.2. Receiving . . . . . . . . . . . . . . . . . . . . . . . . 7
5. DEFLATE method . . . . . . . . . . . . . . . . . . . . . . . . 8 5. DEFLATE method . . . . . . . . . . . . . . . . . . . . . . . . 8
5.1. Method Parameters . . . . . . . . . . . . . . . . . . . . 8 5.1. Method Parameters . . . . . . . . . . . . . . . . . . . . 8
5.1.1. Disallow compression context takeover . . . . . . . . 8 5.1.1. Disallow compression context takeover . . . . . . . . 8
5.1.2. Limit maximum LZ77 sliding window size . . . . . . . . 9 5.1.2. Limit maximum LZ77 sliding window size . . . . . . . . 9
5.2. Application Data Transformation . . . . . . . . . . . . . 9 5.1.3. Example . . . . . . . . . . . . . . . . . . . . . . . 9
5.2.1. Compression . . . . . . . . . . . . . . . . . . . . . 9 5.2. Application Data Transformation . . . . . . . . . . . . . 10
5.2.1. Compression . . . . . . . . . . . . . . . . . . . . . 10
5.2.2. Decompression . . . . . . . . . . . . . . . . . . . . 11 5.2.2. Decompression . . . . . . . . . . . . . . . . . . . . 11
5.2.3. Examples . . . . . . . . . . . . . . . . . . . . . . . 11 5.2.3. Examples . . . . . . . . . . . . . . . . . . . . . . . 12
5.3. Intermediaries . . . . . . . . . . . . . . . . . . . . . . 14 5.3. Intermediaries . . . . . . . . . . . . . . . . . . . . . . 14
5.4. Implementation Notes . . . . . . . . . . . . . . . . . . . 14 5.4. Implementation Notes . . . . . . . . . . . . . . . . . . . 15
6. Security Considerations . . . . . . . . . . . . . . . . . . . 15 6. Security Considerations . . . . . . . . . . . . . . . . . . . 16
7. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 16 7. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 17
7.1. Registration of the "permessage-compress" WebSocket 7.1. Registration of the "permessage-compress" WebSocket
Extension Name . . . . . . . . . . . . . . . . . . . . . . 16 Extension Name . . . . . . . . . . . . . . . . . . . . . . 17
7.2. Registration of the "Per-message Compressed" WebSocket 7.2. Registration of the "Per-message Compressed" WebSocket
Framing Header Bit . . . . . . . . . . . . . . . . . . . . 16 Framing Header Bit . . . . . . . . . . . . . . . . . . . . 17
7.3. WebSocket Per-message Compression Method Name Registry . . 17 7.3. WebSocket Per-message Compression Method Name Registry . . 18
8. Acknowledgements . . . . . . . . . . . . . . . . . . . . . . . 18 8. Acknowledgements . . . . . . . . . . . . . . . . . . . . . . . 19
9. References . . . . . . . . . . . . . . . . . . . . . . . . . . 19 9. References . . . . . . . . . . . . . . . . . . . . . . . . . . 20
9.1. Normative References . . . . . . . . . . . . . . . . . . . 19 9.1. Normative References . . . . . . . . . . . . . . . . . . . 20
9.2. Informative References . . . . . . . . . . . . . . . . . . 19 9.2. Informative References . . . . . . . . . . . . . . . . . . 20
Author's Address . . . . . . . . . . . . . . . . . . . . . . . . . 20 Author's Address . . . . . . . . . . . . . . . . . . . . . . . . . 21
1. Introduction 1. Introduction
_This section is non-normative._ _This section is non-normative._
As well as other communication protocols, the WebSocket Protocol As well as other communication protocols, the WebSocket Protocol
[RFC6455] can benefit from compression technology. This [RFC6455] can benefit from compression technology. This
specification defines a WebSocket extension that applies a specification defines a WebSocket extension that applies a
compression algorithm to octets exchanged over the WebSocket Protocol compression algorithm to octets exchanged over the WebSocket Protocol
using its extension framework. This extension negotiates what using its extension framework. This extension negotiates what
skipping to change at page 9, line 20 skipping to change at page 9, line 20
"c2s_no_context_takeover" method parameter. A client that received "c2s_no_context_takeover" method parameter. A client that received
this parameter MUST reset its LZ77 sliding window for sending to this parameter MUST reset its LZ77 sliding window for sending to
empty for each message. empty for each message.
These parameters have no value. These parameters have no value.
5.1.2. Limit maximum LZ77 sliding window size 5.1.2. Limit maximum LZ77 sliding window size
A client MAY attach the "s2c_max_window_bits" method parameter to A client MAY attach the "s2c_max_window_bits" method parameter to
limit the LZ77 sliding window size that the server uses to build limit the LZ77 sliding window size that the server uses to build
messages. This parameter MUST have an integer value in the range messages. This parameter MUST have a decimal integer value in the
between 8 to 15 indicating the base-2 logarithm of the LZ77 sliding range between 8 to 15 indicating the base-2 logarithm of the LZ77
window size. Servers MAY be able to accept the "s2c_max_window_bits" sliding window size. The ABNF [RFC5234] for the value of this
method parameter. If the "accepted request" has this method parameter is 1*DIGIT. Servers MAY be able to accept the
parameter, the server: "s2c_max_window_bits" method parameter. If the "accepted request"
has this method parameter, the server:
o MUST attach this method parameter with the same value as one of o MUST attach this method parameter with the same value as one of
the "accepted request" to its "method agreement" the "accepted request" to its "method agreement"
o MUST NOT use LZ77 sliding window size greater than the size o MUST NOT use LZ77 sliding window size greater than the size
specified by this parameter to build messages specified by this parameter to build messages
A client MAY attach the "c2s_max_window_bits" method parameter if the A client MAY attach the "c2s_max_window_bits" method parameter if the
client can adjust LZ77 sliding window size based on the client can adjust LZ77 sliding window size based on the
"c2s_max_window_bits" sent by the server. This parameter has no "c2s_max_window_bits" sent by the server. This parameter has no
value. value.
If the "accepted request" has the "c2s_max_window_bits" method If the "accepted request" has the "c2s_max_window_bits" method
parameter, the server MAY attach the "c2s_max_window_bits" method parameter, the server MAY attach the "c2s_max_window_bits" method
parameter to limit the LZ77 sliding window size that the client uses parameter to limit the LZ77 sliding window size that the client uses
to build messages. Otherwise, the server MUST NOT attach the to build messages. Otherwise, the server MUST NOT attach the
parameter. This parameter sent by the server MUST have an integer parameter. This parameter sent by the server MUST have a decimal
value in the range between 8 to 15 indicating the base-2 logarithm of integer value in the range between 8 to 15 indicating the base-2
the LZ77 sliding window size. A client that received this parameter logarithm of the LZ77 sliding window size. The ABNF for the value of
this parameter is 1*DIGIT. A client that received this parameter
MUST NOT use LZ77 sliding window size greater than the size specified MUST NOT use LZ77 sliding window size greater than the size specified
by this parameter to build messages. by this parameter to build messages.
5.1.3. Example
_This section is non-normative._
This example sent by a client is asking the server to use LZ77
sliding window size of 1,024 bytes or less and declaring that the
client can accept the "c2s_max_window_bits" parameter.
Sec-WebSocket-Extensions: permessage-compress;
method="deflate; c2s_max_window_bits;
s2c_max_window_bits=10"
This request might be rejected by the server because it doesn't
support the "s2c_max_window_bits" parameter. Since there's only one
method description listed in the header, the server need to give up
use of the Per-message Compression Extension entirely. If reduction
of LZ77 sliding window size by the server is mandatory for the
client, this is fine.
The next example lists two configurations so that the server can
accept permessage-compress by picking one of the configurations it
supports.
Sec-WebSocket-Extensions: permessage-compress;
method="deflate; s2c_max_window_bits=10, deflate"
The server can choose to accept the second description by sending
back this for example:
Sec-WebSocket-Extensions: permessage-compress;
method=deflate
Since the "c2s_max_window_bits" parameter was not specified for both
of the method descriptions, the server cannot use the
"c2s_max_window_bits" parameter.
5.2. Application Data Transformation 5.2. Application Data Transformation
5.2.1. Compression 5.2.1. Compression
An endpoint MUST use the following algorithm to compress a message. An endpoint MUST use the following algorithm to compress a message.
1. Compress all the octets of the payload of the message using 1. Compress all the octets of the payload of the message using
DEFLATE. DEFLATE.
2. If the resulting data does not end with an empty block with no 2. If the resulting data does not end with an empty block with no
skipping to change at page 19, line 13 skipping to change at page 20, line 13
WebSocket Protocol to which I referred to write this specification. WebSocket Protocol to which I referred to write this specification.
9. References 9. References
9.1. Normative References 9.1. Normative References
[RFC5226] Narten, T. and H. Alvestrand, "Guidelines for Writing an [RFC5226] Narten, T. and H. Alvestrand, "Guidelines for Writing an
IANA Considerations Section in RFCs", BCP 26, RFC 5226, IANA Considerations Section in RFCs", BCP 26, RFC 5226,
May 2008. May 2008.
[RFC5234] Crocker, D. and P. Overell, "Augmented BNF for Syntax
Specifications: ABNF", STD 68, RFC 5234, January 2008.
[RFC6455] Fette, I. and A. Melnikov, "The WebSocket Protocol", [RFC6455] Fette, I. and A. Melnikov, "The WebSocket Protocol",
RFC 6455, December 2011. RFC 6455, December 2011.
[RFC2119] Bradner, S., "Key words for use in RFCs to Indicate [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate
Requirement Levels", BCP 14, RFC 2119, March 1997. Requirement Levels", BCP 14, RFC 2119, March 1997.
[LZ77] Ziv, J. and A. Lempel, "A Universal Algorithm for [LZ77] Ziv, J. and A. Lempel, "A Universal Algorithm for
Sequential Data Compression", IEEE Transactions on Sequential Data Compression", IEEE Transactions on
Information Theory, Vol. 23, No. 3, pp. 337-343. Information Theory, Vol. 23, No. 3, pp. 337-343.
 End of changes. 12 change blocks. 
26 lines changed or deleted 67 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/