idnits 2.17.1 draft-ietf-hybi-permessage-compression-22.txt: Checking boilerplate required by RFC 5378 and the IETF Trust (see https://trustee.ietf.org/license-info): ---------------------------------------------------------------------------- No issues found here. Checking nits according to https://www.ietf.org/id-info/1id-guidelines.txt: ---------------------------------------------------------------------------- No issues found here. Checking nits according to https://www.ietf.org/id-info/checklist : ---------------------------------------------------------------------------- No issues found here. Miscellaneous warnings: ---------------------------------------------------------------------------- == The copyright year in the IETF Trust and authors Copyright Line does not match the current year -- The document date (June 11, 2015) is 3235 days in the past. Is this intentional? Checking references for intended status: Proposed Standard ---------------------------------------------------------------------------- (See RFCs 3967 and 4897 for information about using normative references to lower-maturity documents in RFCs) ** Downref: Normative reference to an Informational RFC: RFC 1951 -- Possible downref: Non-RFC (?) normative reference: ref. 'LZ77' Summary: 1 error (**), 0 flaws (~~), 1 warning (==), 2 comments (--). Run idnits with the --verbose option for more detailed information about the items above. -------------------------------------------------------------------------------- 2 HyBi Working Group T. Yoshino 3 Internet-Draft Google, Inc. 4 Intended status: Standards Track June 11, 2015 5 Expires: December 13, 2015 7 Compression Extensions for WebSocket 8 draft-ietf-hybi-permessage-compression-22 10 Abstract 12 This document defines a framework for creating WebSocket extensions 13 that add compression functionality to the WebSocket Protocol. An 14 extension based on this framework compresses the payload data portion 15 of WebSocket data messages on a per-message basis using parameters 16 negotiated during the opening handshake. This framework provides a 17 general method for applying a compression algorithm to the contents 18 of WebSocket messages. Each compression algorithm has to be defined 19 in a document defining the extension by specifying parameter 20 negotiation and payload transformation algorithm in detail. This 21 document also specifies one specific compression extension using the 22 DEFLATE algorithm. 24 Please send feedback to the hybi@ietf.org mailing list. 26 Status of this Memo 28 This Internet-Draft is submitted to IETF in full conformance with the 29 provisions of BCP 78 and BCP 79. 31 Internet-Drafts are working documents of the Internet Engineering 32 Task Force (IETF). Note that other groups may also distribute 33 working documents as Internet-Drafts. The list of current Internet- 34 Drafts is at http://datatracker.ietf.org/drafts/current. 36 Internet-Drafts are draft documents valid for a maximum of six months 37 and may be updated, replaced, or obsoleted by other documents at any 38 time. It is inappropriate to use Internet-Drafts as reference 39 material or to cite them other than as "work in progress." 41 This Internet-Draft will expire on December 13, 2015. 43 Copyright Notice 45 Copyright (c) 2015 IETF Trust and the persons identified as the 46 document authors. All rights reserved. 48 This document is subject to BCP 78 and the IETF Trust's Legal 49 Provisions Relating to IETF Documents 50 (http://trustee.ietf.org/license-info) in effect on the date of 51 publication of this document. Please review these documents 52 carefully, as they describe your rights and restrictions with respect 53 to this document. Code Components extracted from this document must 54 include Simplified BSD License text as described in Section 4.e of 55 the Trust Legal Provisions and are provided without warranty as 56 described in the Simplified BSD License. 58 Table of Contents 60 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . . 3 61 2. Conformance Requirements and Terminology . . . . . . . . . . . 4 62 3. Complementary Terminology . . . . . . . . . . . . . . . . . . 5 63 4. WebSocket Per-message Compression Extension . . . . . . . . . 6 64 5. Extension Negotiation . . . . . . . . . . . . . . . . . . . . 7 65 5.1. General Negotiation Flow . . . . . . . . . . . . . . . . . 9 66 5.2. Negotiation Examples . . . . . . . . . . . . . . . . . . . 10 67 6. Framing . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 68 6.1. Compression . . . . . . . . . . . . . . . . . . . . . . . 12 69 6.2. Decompression . . . . . . . . . . . . . . . . . . . . . . 13 70 7. Intermediaries . . . . . . . . . . . . . . . . . . . . . . . . 15 71 8. permessage-deflate extension . . . . . . . . . . . . . . . . . 16 72 8.1. Method Parameters . . . . . . . . . . . . . . . . . . . . 17 73 8.1.1. Context Takeover Control . . . . . . . . . . . . . . . 17 74 8.1.2. Limiting the LZ77 sliding window size . . . . . . . . 19 75 8.1.3. Examples . . . . . . . . . . . . . . . . . . . . . . . 21 76 8.2. Message Payload Transformation . . . . . . . . . . . . . . 22 77 8.2.1. Compression . . . . . . . . . . . . . . . . . . . . . 22 78 8.2.2. Decompression . . . . . . . . . . . . . . . . . . . . 23 79 8.2.3. Examples . . . . . . . . . . . . . . . . . . . . . . . 24 80 8.3. Implementation Notes . . . . . . . . . . . . . . . . . . . 28 81 8.4. Intermediaries . . . . . . . . . . . . . . . . . . . . . . 28 82 9. Security Considerations . . . . . . . . . . . . . . . . . . . 29 83 10. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 30 84 10.1. Registration of the "permessage-deflate" WebSocket 85 Extension Name . . . . . . . . . . . . . . . . . . . . . . 30 86 10.2. Registration of the "Per-message Compressed" WebSocket 87 Framing Header Bit . . . . . . . . . . . . . . . . . . . . 30 88 11. Acknowledgements . . . . . . . . . . . . . . . . . . . . . . . 31 89 12. References . . . . . . . . . . . . . . . . . . . . . . . . . . 32 90 12.1. Normative References . . . . . . . . . . . . . . . . . . . 32 91 12.2. Informative References . . . . . . . . . . . . . . . . . . 32 92 Author's Address . . . . . . . . . . . . . . . . . . . . . . . . . 33 94 1. Introduction 96 This document specifies a framework for adding compression 97 functionality to the WebSocket Protocol [RFC6455]. The framework 98 specifies how to define WebSocket Per-message Compression Extensions 99 (PMCEs) for a compression algorithm based on the extension concept of 100 the WebSocket Protocol specified in Section 9 of [RFC6455]. A 101 WebSocket client and a peer WebSocket server negotiate the use of a 102 PMCE and determine the parameters required to configure the 103 compression algorithm during the WebSocket opening handshake. The 104 client and server can then exchange data messages whose frames 105 contain compressed data in the payload data portion. 107 This framework only specifies a general method for applying a 108 compression algorithm to the contents of WebSocket messages. Each 109 individual PMCE has to be specified in a document describing in 110 detail how to negotiate the configuration parameters for the specific 111 compression algorithm used by that PMCE and how to transform 112 (compress and decompress) data in the payload data portion. 114 A WebSocket client may offer multiple PMCEs during the WebSocket 115 opening handshake. A peer WebSocket server receiving the offer may 116 choose to accept the preferred PMCE or decline all of them. PMCEs 117 use the RSV1 bit of the WebSocket frame header to indicate whether a 118 message is compressed or not, so that an endpoint can choose not to 119 compress messages with incompressible contents. 121 This document also specifies one specific PMCE based on the DEFLATE 122 [RFC1951] algorithm. The DEFLATE algorithm is widely available on 123 various platforms and its overhead is small. The extension name of 124 this PMCE is "permessage-deflate". To align the end of compressed 125 data to an octet boundary, this extension uses the algorithm 126 described in Section 2.1 of [RFC1979]. Endpoints can take over the 127 LZ77 sliding window [LZ77] used to build frames for previous messages 128 to achieve a better compression ratio. For resource-limited devices, 129 this extension provides parameters to limit memory usage for 130 compression context. 132 2. Conformance Requirements and Terminology 134 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 135 "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this 136 document are to be interpreted as described in [RFC2119]. 138 Requirements phrased in the imperative as part of algorithms (such as 139 "strip any leading space characters" or "return false and abort these 140 steps") are to be interpreted with the meaning of the key word 141 ("MUST", "SHOULD", "MAY", etc.) used in introducing the algorithm. 143 Conformance requirements phrased as algorithms or specific steps can 144 be implemented in any manner, so long as the end result is 145 equivalent. In particular, the algorithms defined in this 146 specification are intended to be easy to understand and are not 147 intended to be performant. 149 This document references the procedure to _Fail the WebSocket 150 Connection_. This procedure is defined in Section 7.1.7 of 151 [RFC6455]. 153 This document references the event that _The WebSocket Connection is 154 Established_ and the event that _A WebSocket Message Has Been 155 Received_. These events are defined in Section 4.1 and Section 6.2, 156 respectively, of [RFC6455]. 158 This document uses the Augmented Backus-Naur Form (ABNF) notation of 159 [RFC5234]. The DIGIT (decimal 0-9) rule is included by reference, as 160 defined in the Appendix B.1 of [RFC5234]. 162 3. Complementary Terminology 164 This document defines some terms about WebSocket and WebSocket 165 Extension mechanisms that are underspecified or not defined at all in 166 [RFC6455]. This terminology is effective only in this document and 167 any other documents explicitly referring to this section. 169 "A data message" means a message consisting of Data Frames as defined 170 in Section 5.6 of [RFC6455]. 172 "A message payload (or payload of a message)" means the concatenation 173 of the payload data portion of all Data Frames (see Section 6.2 of 174 [RFC6455]) representing a single message. 176 "An extension in use next to extension X" means the extension listed 177 next to X in the "Sec-WebSocket-Extensions" header in the server's 178 opening handshake as defined in Section 9.1 of [RFC6455]. Such an 179 extension is applied to outgoing data from the application right 180 after X on the sender side, but applied right before X to incoming 181 data from the underlying transport. 183 "An extension in use preceding extension X" means the extension 184 listed right before X in the "Sec-WebSocket-Extensions" header in the 185 server's opening handshake. Such an extension is applied to outgoing 186 data from the application right before X on the sender side, but 187 applied right after X to incoming data from the underlying transport. 189 "An extension negotiation offer" means each element in the 190 "Sec-WebSocket-Extensions" header in the client's opening handshake. 192 "An extension negotiation response" means each element in the 193 "Sec-WebSocket-Extensions" header in the server's opening handshake. 195 "A corresponding extension negotiation response for an extension 196 negotiation offer" means an extension negotiation response that a 197 server sends back to the peer client containing the same extension 198 name as the offer and meeting the requirements represented by the 199 offer. 201 "Accepting an extension negotiation offer" means including a 202 corresponding extension negotiation response for the offer in the 203 "Sec-WebSocket-Extensions" header in the server's opening handshake. 205 "Declining an extension negotiation offer" means not including a 206 corresponding extension negotiation response for the offer in the 207 "Sec-WebSocket-Extensions" header in the server's opening handshake. 209 4. WebSocket Per-message Compression Extension 211 WebSocket Per-message Compression Extensions (PMCEs) are extensions 212 to the WebSocket Protocol enabling compression functionality. PMCEs 213 are built based on the extension concept of the WebSocket Protocol 214 specified in Section 9 of [RFC6455]. PMCEs are individually defined 215 for each compression algorithm to be implemented, and are registered 216 in the WebSocket Extension Name Registry created in Section 11.4 of 217 [RFC6455]. Each PMCE referring to this framework MUST define the 218 following: 220 o The extension name of the PMCE and any applicable extension 221 parameters that MUST be included in the "Sec-WebSocket-Extensions" 222 header during the extension negotiation offer/response. 224 o How to interpret the extension parameters exchanged during the 225 opening handshake. 227 o How to transform the payload of a message. 229 One PMCE extension is defined in Section 8 of this document and is 230 registered in Section 10. Other PMCEs may be defined in the future 231 in other documents. 233 Section 5 describes the basic extension negotiation process. 234 Section 6 describes how to apply the compression algorithm with 235 negotiated parameters to the contents of WebSocket messages. 237 5. Extension Negotiation 239 To offer use of a PMCE, a client MUST include the extension name of 240 the PMCE in the "Sec-WebSocket-Extensions" header field of its 241 opening handshake of the WebSocket connection. Extension parameters 242 are used to specify the PMCE offer in detail. For example, a client 243 lists its preferred configuration parameter values for the 244 compression algorithm of the PMCE. A client may also offer multiple 245 PMCE choices to the server by including multiple elements in the 246 "Sec-WebSocket-Extensions" header, one for each PMCE offered. This 247 set of elements MAY include multiple PMCEs with the same extension 248 name to offer the possibility to use the same algorithm with 249 different configuration parameters. The order of elements is 250 important as it specifies the client's preference. An element 251 preceding another element has higher preference. It is recommended 252 that a server accepts PMCEs with higher preference if the server 253 supports them. 255 A PMCE negotiation offer provides requests and/or hints to the 256 server. 258 A request in a PMCE negotiation offer indicates constraints on the 259 server's behavior that must be satisfied if the server accepts the 260 offer. For example, suppose that a server sends data compressed with 261 the DEFLATE algorithm to a client. The server must keep the original 262 bytes of data that it recently compressed and sent to the client. 263 The client must keep the result of decompressing the bytes of data 264 that it recently received from the server. The amount of bytes of 265 data kept is called the LZ77 window size. The LZ77 window size of 266 the client must not be less than the LZ77 window size of the server. 267 In a PMCE negotiation offer, the client MUST inform the server of its 268 LZ77 window size so that the server uses an LZ77 window size that is 269 not greater than the LZ77 window size of the client. This 270 restriction on the LZ77 window size is an example of a request in a 271 PMCE negotiation offer. 273 A hint in a PMCE negotiation offer provides information about the 274 client's behavior that the server may either safely ignore or refer 275 to when the server decides its behavior. For example, suppose that a 276 client sends data compressed with the DEFLATE algorithm to a server. 277 The client must keep the original bytes of data that it recently 278 compressed and sent to the server. The server must keep the result 279 of decompressing the bytes of data that it recently received from the 280 client. The LZ77 window size of the server must not be less than the 281 LZ77 window size of the client. In a PMCE negotiation offer, the 282 client may inform the maximum LZ77 window size the client can afford 283 so that the server can choose to use an LZ77 window size that is not 284 greater than the maximum size of the client. This information is an 285 example of a hint in a PMCE negotiation offer. It's waste of memory 286 to use an LZ77 window size greater than the LZ77 window size the 287 client actually uses. Using the hint, the server can avoid the waste 288 of memory. Since the hint itself doesn't specify the constraints on 289 the endpoints, the server must use the "agreed parameters" (defined 290 below) to explicitly ask the client not to use an LZ77 window size 291 greater than the LZ77 window size of the server. 293 To accept the use of an offered PMCE, a server MUST include the 294 extension name of the PMCE in the "Sec-WebSocket-Extensions" header 295 field of its opening handshake of the WebSocket connection. 296 Extension parameters represent the detailed configuration parameters 297 of the PMCE to use. These extension parameters and their values are 298 called "agreed parameters". The element MUST represent a PMCE that 299 is fully supported by the server. The contents of the element don't 300 need to be exactly the same as those of the received extension 301 negotiation offers. For example, suppose that a server received a 302 PMCE extension negotiation offer with an extension parameter "X" 303 indicating that the client can enable an optional feature named X. 304 The server may accept the PMCE offer with an element without the 305 extension parameter "X" meaning that the server chose not to enable 306 the feature X. In this case, the offer contains the extension 307 parameter "X" but the "agreed parameters" don't contain the extension 308 parameter "X". 310 "Agreed parameters" MUST represent how the requests and hints in the 311 client's extension negotiation offer have been handled in addition to 312 the server's requests and hints on the client's behavior, so that the 313 client can configure its behavior without identifying exactly which 314 PMCE extension negotiation offer has been accepted. 316 For example, if a client sends an extension negotiation offer that 317 includes a parameter "enable_compression" and another without this 318 parameter, the server accepts the former and informs the client by 319 sending back an element that includes parameter(s) acknowledging 320 "enable_compression". The name of the acknowledging parameter 321 doesn't need to be exactly the same as the offer. For example, two 322 parameters "enable_strong_compression" and "enable_weak_compression" 323 may be defined as acknowledging parameters for "enable_compression". 325 Compression features can be applied differently for each direction. 326 For such features, the acknowledging parameter and the parameter in 327 the reverse direction must be chosen to distinguish them. For 328 example, in order to make parameters distinguishable, a "server_" 329 prefix can be added to parameters affecting data sent from a server 330 and a "client_" prefix can be added to parameters affecting data sent 331 from a client. 333 A server MUST NOT accept a PMCE extension negotiation offer together 334 with another extension if the PMCE will conflict with the extension 335 on their use of the RSV1 bit. A client that received a response 336 accepting a PMCE extension negotiation offer together with such an 337 extension MUST _Fail the WebSocket Connection_. 339 A server MUST NOT accept a PMCE extension negotiation offer together 340 with another extension if the PMCE will be applied to the output of 341 the extension and any of the following conditions applies to the 342 extension: 344 o The extension requires the boundary of frames to be preserved 345 between the output from the extension at the sender and the input 346 to the extension at the receiver. 348 o The extension uses the "Extension data" field or any of the 349 reserved bits on the WebSocket header as a per-frame attribute. 351 A client that receives a response accepting a PMCE extension 352 negotiation offer together with such an extension MUST _Fail the 353 WebSocket Connection_. 355 A server declining all offered PMCEs MUST NOT include any element 356 with PMCE names. If a server responds with no PMCE element in the 357 "Sec-WebSocket-Extensions" header, both endpoints proceed without 358 Per-message Compression once _the WebSocket Connection is 359 established_. 361 If a server gives an invalid response, such as accepting a PMCE that 362 the client did not offer, the client MUST _Fail the WebSocket 363 Connection_. 365 If a server responds with a valid PMCE element in the 366 "Sec-WebSocket-Extensions" header and _the WebSocket Connection is 367 established_, both endpoints MUST use the algorithm described in 368 Section 6 and the message payload transformation (compressing and 369 decompressing) procedure of the PMCE configured with the "agreed 370 parameters" returned by the server to exchange messages. 372 5.1. General Negotiation Flow 374 This section describes a general negotiation flow. How to handle 375 parameters in detail must be specified in the document specifying the 376 PMCE. 378 A client makes an offer including parameters identifying the 379 following: 381 o Hints about how the client is planning to compress data 383 o Requests about how the server compresses data 385 o Limitations concerning the client's compression functionality 387 The peer server makes a determination of its behavior based on these 388 parameters. If the server can and wants to proceed with this PMCE 389 enabled, the server responds to the client with parameters 390 identifying the following: 392 o Requests about how the client compresses data 394 o How the server will compress data 396 Based on these parameters received from the server, the client 397 determines its behavior and if it can and wants to proceed with this 398 PMCE enabled. Otherwise, the client starts closing handshake with 399 close code 1010. 401 5.2. Negotiation Examples 403 The following are example values for the "Sec-WebSocket-Extensions" 404 header offering PMCEs. permessage-foo and permessage-bar in the 405 examples are hypothetical extension names of PMCEs for compression 406 algorithm foo and bar. 408 o Offer the permessage-foo. 410 permessage-foo 412 o Offer the permessage-foo with a parameter x with a value of 10. 414 permessage-foo; x=10 416 The value MAY be quoted. 418 permessage-foo; x="10" 420 o Offer the permessage-foo as first choice and the permessage-bar as 421 a fallback plan. 423 permessage-foo, permessage-bar 425 o Offer the permessage-foo with a parameter use_y which enables a 426 feature y as first choice, and the permessage-foo without the 427 use_y parameter as a fallback plan. 429 permessage-foo; use_y, permessage-foo 431 6. Framing 433 PMCEs operate only on data messages. 435 This document allocates the RSV1 bit of the WebSocket header for 436 PMCEs, and calls the bit the "Per-message Compressed" bit. On a 437 WebSocket connection where a PMCE is in use, this bit indicates 438 whether a message is compressed or not. 440 A message with the "Per-message Compressed" bit set on the first 441 fragment of the message is called a "compressed message". Frames of 442 a compressed message have compressed data in the payload data 443 portion. An endpoint receiving a compressed message decompresses the 444 concatenation of the compressed data of the frames of the message by 445 following the decompression procedure specified by the PMCE in use. 446 The endpoint uses the bytes corresponding to the application data 447 portion in this decompressed data for the _A WebSocket Message Has 448 Been Received_ event instead of the received data as-is. 450 A message with the "Per-message Compressed" bit unset on the first 451 fragment of the message is called an "uncompressed message". Frames 452 of an uncompressed message have uncompressed original data as-is in 453 the payload data portion. An endpoint receiving an uncompressed 454 message uses the concatenation of the application data portion of the 455 frames of the message as-is for the _A WebSocket Message Has Been 456 Received_ event. 458 6.1. Compression 460 An endpoint MUST use the following algorithm to send a message in the 461 form of a compressed message. 463 1. Compress the message payload of the original message by following 464 the compression procedure of the PMCE. The original message may 465 be input from the application layer or output of another 466 WebSocket extension depending on which extensions were 467 negotiated. 469 2. If this PMCE is the last extension to process of outgoing 470 messages, build frame(s) by using the compressed data instead of 471 the original data for the message payload, and set the 472 "Per-message Compressed" bit of the first frame, then send the 473 frame(s) as described in Section 6.1 of RFC6455. Otherwise, pass 474 the transformed message payload and modified header values 475 including the "Per-message Compressed" bit value set to 1 to the 476 extension next to the PMCE. If the extension expects frames for 477 input, build a frame for the message and pass it. 479 An endpoint MUST use the following algorithm to send a message in the 480 form of an uncompressed message. 482 1. If this PMCE is the last extension to process of outgoing 483 messages, build frame(s) by using the original data for the 484 payload data portion as-is and unset the "Per-message Compressed" 485 bit of the first frame, then send the frame(s) as described in 486 Section 6.1 of RFC6455. Otherwise, pass the message payload and 487 header values to the extension next to the PMCE as-is. If the 488 extension expects frames for input, build a frame for the message 489 and pass it. 491 An endpoint MUST NOT set the "Per-message Compressed" bit of control 492 frames and non-first fragments of a data message. An endpoint 493 receiving such a frame MUST _Fail the WebSocket Connection_. 495 PMCEs do not change the opcode field. The opcode of the first frame 496 of a compressed message indicates the opcode of the original message. 498 The payload data portion in frames generated by a PMCE is not subject 499 to the constraints for the original data type. For example, the 500 concatenation of the output data corresponding to the application 501 data portion of frames of a compressed text message is not required 502 to be valid UTF-8. At the receiver, the payload data portion after 503 decompression is subject to the constraints for the original data 504 type again. 506 6.2. Decompression 508 An endpoint MUST use the following algorithm to receive a message in 509 the form of a compressed message. 511 1. Concatenate the payload data portion of the received frames of 512 the compressed message. The received frames may be direct input 513 from the underlying transport or output of another WebSocket 514 extension depending on which extensions were negotiated. 516 2. Decompress the concatenation by following the decompression 517 procedure of the PMCE. 519 3. If this is the last extension to process incoming messages, 520 deliver the _A WebSocket Message Has Been Received_ event to the 521 application layer with the decompressed message payload and 522 header values including the "Per-message Compressed" bit unset to 523 0. Otherwise, pass the decompressed message payload and header 524 values including the "Per-message Compressed" bit unset to 0 to 525 the extension preceding the PMCE. If the extension expects 526 frames for input, build a frame for the message and pass it. 528 An endpoint MUST use the following algorithm to receive a message in 529 the form of an uncompressed message. 531 1. If this PMCE is the last extension to process incoming messages, 532 deliver the _A WebSocket Message Has Been Received_ event to the 533 application layer with the received message payload and header 534 values as-is. Otherwise, pass the message payload and header 535 values to the extension preceding the PMCE as-is. If the 536 extension expects frames for input, build a frame for the message 537 and pass it. 539 7. Intermediaries 541 When an intermediary proxies a WebSocket connection, the intermediary 542 MAY add, change or remove Per-message Compression of proxied messages 543 if the intermediary meets all of the following requirements: 545 o The intermediary understands the PMCE. 547 o The intermediary can read all data of the proxied WebSocket 548 connection including the opening handshake request, opening 549 handshake response, and messages. 551 o The intermediary can alter the proxied data before forwarding them 552 in accordance with to the constraints of the new combination of 553 extensions. For example, if Per-message Compression is removed 554 from messages, the corresponding element in the 555 "Sec-WebSocket-Extensions" header in the opening handshake 556 response which enabled the Per-message Compression must also be 557 removed. 559 Otherwise, the intermediary MUST NOT add, change or remove Per- 560 message Compression of proxied messages. 562 8. permessage-deflate extension 564 This section defines a specific PMCE called "permessage-deflate". It 565 compresses the payload of a message using the DEFLATE algorithm 566 [RFC1951] and uses the byte boundary alignment method introduced in 567 [RFC1979]. 569 This section uses the term "byte" with the same meaning as RFC1951, 570 i.e. 8 bits stored or transmitted as a unit (same as an octet). 572 The registered extension name for this extension is 573 "permessage-deflate". 575 Four extension parameters are defined for "permessage-deflate" to 576 help endpoints manage per-connection resource usage. 578 o "server_no_context_takeover" 580 o "client_no_context_takeover" 582 o "server_max_window_bits" 584 o "client_max_window_bits" 586 These parameters enable two methods (no_context_takeover and 587 max_window_bits) of constraining memory usage that may be applied 588 independently to either direction of WebSocket traffic. The 589 extension parameters with the "client_" prefix are used by the client 590 to configure its compressor and by the server to configure its 591 decompressor. The extension parameters with the "server_" prefix are 592 used by the server to configure its compressor and by the client to 593 configure its decompressor. All four parameters are defined for both 594 a client's extension negotiation offer and a server's extension 595 negotiation response. 597 A server MUST decline an extension negotiation offer for this 598 extension if any of the following conditions are met: 600 o The negotiation offer contains an extension parameter not defined 601 for use in an offer. 603 o The negotiation offer contains an extension parameter with an 604 invalid value. 606 o The negotiation offer contains multiple extension parameters with 607 the same name. 609 o The server doesn't support the offered configuration. 611 A client MUST _Fail the WebSocket Connection_ if the peer server 612 accepted an extension negotiation offer for this extension with an 613 extension negotiation response meeting any of the following 614 conditions: 616 o The negotiation response contains an extension parameter not 617 defined for use in a response. 619 o The negotiation response contains an extension parameter with an 620 invalid value. 622 o The negotiation response contains multiple extension parameters 623 with the same name. 625 o The client does not support the configuration that the response 626 represents. 628 The term "LZ77 sliding window" used in this section means the buffer 629 used by the DEFLATE algorithm to store recently processed input. The 630 DEFLATE compression algorithm searches the buffer for a match with 631 the following input. 633 The term "use context take over" used in this section means that the 634 same LZ77 sliding window used by the endpoint to build frames of the 635 previous sent message is reused to build frames of the next message 636 to be sent. 638 8.1. Method Parameters 640 8.1.1. Context Takeover Control 642 8.1.1.1. server_no_context_takeover 644 A client MAY include the "server_no_context_takeover" extension 645 parameter in an extension negotiation offer. This extension 646 parameter has no value. By including this extension parameter in an 647 extension negotiation offer, a client prevents the peer server from 648 using context take over. If the peer server doesn't use context take 649 over, the client doesn't need to reserve memory to retain the LZ77 650 sliding window between messages. 652 Absence of this extension parameter in an extension negotiation offer 653 indicates that the client can decompress a message which the server 654 built using context take over. 656 A server accepts an extension negotiation offer that includes the 657 "server_no_context_takeover" extension parameter by including the 658 "server_no_context_takeover" extension parameter in the corresponding 659 extension negotiation response to send back to the client. The 660 "server_no_context_takeover" extension parameter in an extension 661 negotiation response has no value. 663 It is RECOMMENDED that a server supports the 664 "server_no_context_takeover" extension parameter in an extension 665 negotiation offer. 667 A server MAY include the "server_no_context_takeover" extension 668 parameter in an extension negotiation response even if the extension 669 negotiation offer being accepted by the extension negotiation 670 response didn't include the "server_no_context_takeover" extension 671 parameter. 673 8.1.1.2. client_no_context_takeover 675 A client MAY include the "client_no_context_takeover" extension 676 parameter in an extension negotiation offer. This extension 677 parameter has no value. By including this extension parameter in an 678 extension negotiation offer, a client informs the peer server of a 679 hint that even if the server doesn't include the 680 "client_no_context_takeover" extension parameter in the corresponding 681 extension negotiation response to the offer, the client is not going 682 to use context take over. 684 A server MAY include the "client_no_context_takeover" extension 685 parameter in an extension negotiation response. If the received 686 extension negotiation offer includes the "client_no_context_takeover" 687 extension parameter, the server may either ignore the parameter or 688 use the parameter to avoid taking over the LZ77 sliding window 689 unnecessarily by including the "client_no_context_takeover" extension 690 parameter in the corresponding extension negotiation response to the 691 offer. The "client_no_context_takeover" extension parameter in an 692 extension negotiation response has no value. By including the 693 "client_no_context_takeover" extension parameter in an extension 694 negotiation response, a server prevents the peer client from using 695 context take over. This reduces the amount of memory that the server 696 has to reserve for the connection. 698 Absence of this extension parameter in an extension negotiation 699 response indicates that the server can decompress messages built by 700 the client using context take over. 702 A client MUST support the "client_no_context_takeover" extension 703 parameter in an extension negotiation response. 705 8.1.2. Limiting the LZ77 sliding window size 707 8.1.2.1. server_max_window_bits 709 A client MAY include the "server_max_window_bits" extension parameter 710 in an extension negotiation offer. This parameter has a decimal 711 integer value without leading zeroes between 8 to 15 inclusive 712 indicating the base-2 logarithm of the LZ77 sliding window size and 713 MUST conform to the ABNF below. 715 server_max_window_bits = 1*DIGIT 717 By including this parameter in an extension negotiation offer, a 718 client limits the LZ77 sliding window size that the server will use 719 to compress messages. If the peer server uses a small LZ77 sliding 720 window to compress messages, the client can reduce the memory needed 721 for the LZ77 sliding window. 723 A server declines an extension negotiation offer with this parameter 724 if the server doesn't support it. 726 Absence of this parameter in an extension negotiation offer indicates 727 that the client can receive messages compressed using an LZ77 sliding 728 window of up to 32,768 bytes. 730 A server accepts an extension negotiation offer with this parameter 731 by including the "server_max_window_bits" extension parameter in the 732 extension negotiation response to send back to the client with the 733 same or smaller value as the offer. The "server_max_window_bits" 734 extension parameter in an extension negotiation response has a 735 decimal integer value without leading zeroes between 8 to 15 736 inclusive indicating the base-2 logarithm of the LZ77 sliding window 737 size and MUST conform to the ABNF below. 739 server_max_window_bits = 1*DIGIT 741 A server MAY include the "server_max_window_bits" extension parameter 742 in an extension negotiation response even if the extension 743 negotiation offer being accepted by the response didn't include the 744 "server_max_window_bits" extension parameter. 746 8.1.2.2. client_max_window_bits 748 A client MAY include the "client_max_window_bits" extension parameter 749 in an extension negotiation offer. This parameter has no value or a 750 decimal integer value without leading zeroes between 8 to 15 751 inclusive indicating the base-2 logarithm of the LZ77 sliding window 752 size. If a value is specified for this parameter, the value MUST 753 conform to the ABNF below. 755 client_max_window_bits = 1*DIGIT 757 By including this parameter in an offer, a client informs the peer 758 server that the client supports the "client_max_window_bits" 759 extension parameter in an extension negotiation response, and 760 optionally a hint by attaching a value to the parameter. If the 761 "client_max_window_bits" extension parameter in an extension 762 negotiation offer has a value, the parameter also informs the peer 763 server of a hint that even if the server doesn't include the 764 "client_max_window_bits" extension parameter in the corresponding 765 extension negotiation response with a value greater than the one in 766 the extension negotiation offer or the server doesn't include the 767 extension parameter at all, the client is not going to use an LZ77 768 sliding window size greater than the size specified by the value in 769 the extension negotiation offer to compress messages. 771 If a received extension negotiation offer has the 772 "client_max_window_bits" extension parameter, the server MAY include 773 the "client_max_window_bits" extension parameter in the corresponding 774 extension negotiation response to the offer. If the 775 "client_max_window_bits" extension parameter in a received extension 776 negotiation offer has a value, the server may either ignore this 777 value or use this value to avoid allocating an unnecessarily big LZ77 778 sliding window by including the "client_max_window_bits" extension 779 parameter in the corresponding extension negotiation response to the 780 offer with a value equal to or smaller than the received value. The 781 "client_max_window_bits" extension parameter in an extension 782 negotiation response has a decimal integer value without leading 783 zeroes between 8 to 15 inclusive indicating the base-2 logarithm of 784 the LZ77 sliding window size and MUST conform to the ABNF below. 786 client_max_window_bits = 1*DIGIT 788 By including this extension parameter in an extension negotiation 789 response, a server limits the LZ77 sliding window size that the 790 client uses to compress messages. This reduces the amount of memory 791 for the decompression context that the server has to reserve for the 792 connection. 794 If a received extension negotiation offer doesn't have the 795 "client_max_window_bits" extension parameter, the corresponding 796 extension negotiation response to the offer MUST NOT include the 797 "client_max_window_bits" extension parameter. 799 Absence of this extension parameter in an extension negotiation 800 response indicates that the server can receive messages compressed 801 using an LZ77 sliding window of up to 32,768 bytes. 803 8.1.3. Examples 805 The simplest "Sec-WebSocket-Extensions" header in a client's opening 806 handshake to offer use of the permessage-deflate extension looks like 807 this: 809 Sec-WebSocket-Extensions: permessage-deflate 811 Since the "client_max_window_bits" extension parameter is not 812 included in this extension negotiation offer, the server must not 813 accept the offer with an extension negotiation response that includes 814 the "client_max_window_bits" extension parameter. The simplest 815 "Sec-WebSocket-Extensions" header in a server's opening handshake to 816 accept use of the permessage-deflate extension is the same: 818 Sec-WebSocket-Extensions: permessage-deflate 820 The following extension negotiation offer sent by a client is asking 821 the server to use an LZ77 sliding window with a size of 1,024 bytes 822 or less and declaring that the client supports the 823 "client_max_window_bits" extension parameter in an extension 824 negotiation response. 826 Sec-WebSocket-Extensions: 827 permessage-deflate; 828 client_max_window_bits; server_max_window_bits=10 830 This extension negotiation offer might be rejected by the server 831 because the server doesn't support the "server_max_window_bits" 832 extension parameter in an extension negotiation offer. This is fine 833 if the client cannot receive messages compressed using a larger 834 sliding window size, but if the client just prefers using a small 835 window but wants to fall back to the "permessage-deflate" without the 836 "server_max_window_bits" extension parameter, the client can make an 837 offer with the fallback option like this: 839 Sec-WebSocket-Extensions: 840 permessage-deflate; 841 client_max_window_bits; server_max_window_bits=10, 842 permessage-deflate; 843 client_max_window_bits 845 The server can accept permessage-deflate by picking any supported one 846 from the listed offers. To accept the first option, for example, the 847 server may send back a response as follows: 849 Sec-WebSocket-Extensions: 850 permessage-deflate; server_max_window_bits=10 852 To accept the second option, for example, the server may send back a 853 response as follows: 855 Sec-WebSocket-Extensions: permessage-deflate 857 8.2. Message Payload Transformation 859 8.2.1. Compression 861 An endpoint uses the following algorithm to compress a message. 863 1. Compress all the octets of the payload of the message using 864 DEFLATE. 866 2. If the resulting data does not end with an empty DEFLATE block 867 with no compression (the "BTYPE" bits are set to 00), append an 868 empty DEFLATE block with no compression to the tail end. 870 3. Remove 4 octets (that are 0x00 0x00 0xff 0xff) from the tail end. 871 After this step, the last octet of the compressed data contains 872 (possibly part of) the DEFLATE header bits with the "BTYPE" bits 873 set to 00. 875 When using DEFLATE in the first step above: 877 o An endpoint MAY use multiple DEFLATE blocks to compress one 878 message. 880 o An endpoint MAY use DEFLATE blocks of any type. 882 o An endpoint MAY use both DEFLATE blocks with the "BFINAL" bit set 883 to 0 and DEFLATE blocks with the "BFINAL" bit set to 1. 885 o When any DEFLATE block with the "BFINAL" bit set to 1 doesn't end 886 at a byte boundary, an endpoint MUST add minimal padding bits of 0 887 to make it end at a byte boundary. The next DEFLATE block follows 888 the padded data if any. 890 An endpoint fragments a compressed message by splitting the result of 891 running this algorithm. Even when only part of the payload is 892 available, a fragment can be built by compressing the available data 893 and choosing the block type appropriately so that the end of the 894 resulting compressed data is aligned at a byte boundary. Note that 895 for non-final fragments, the removal of 0x00 0x00 0xff 0xff must not 896 be done. 898 An endpoint MUST NOT use an LZ77 sliding window longer than 32,768 899 bytes to compress messages to send. 901 If the "agreed parameters" contain the "client_no_context_takeover" 902 extension parameter, the client MUST start compressing each new 903 message with an empty LZ77 sliding window. Otherwise, the client MAY 904 take over the LZ77 sliding window used to build the last compressed 905 message. Note that even if the client has included the 906 "client_no_context_takeover" extension parameter in its offer, the 907 client MAY take over the LZ77 sliding window used to build the last 908 compressed message if the "agreed parameters" don't contain the 909 "client_no_context_takeover" extension parameter. The client-to- 910 server "client_no_context_takeover" extension parameter is just a 911 hint for the server to build an extension negotiation response. 913 If the "agreed parameters" contain the "server_no_context_takeover" 914 extension parameter, the server MUST start compressing each new 915 message with an empty LZ77 sliding window. Otherwise, the server MAY 916 take over the LZ77 sliding window used to build the last compressed 917 message. 919 If the "agreed parameters" contain the "client_max_window_bits" 920 extension parameter with a value of w, the client MUST NOT use an 921 LZ77 sliding window longer than the w-th power of 2 bytes to compress 922 messages to send. Note that even if the client has included in its 923 offer the "client_max_window_bits" extension parameter with a value 924 smaller than one in the "agreed parameters", the client MAY use an 925 LZ77 sliding window with any size to compress messages to send as 926 long as the size conforms to the "agreed parameters". The client-to- 927 server "client_max_window_bits" extension parameter is just a hint 928 for the server to build an extension negotiation response. 930 If the "agreed parameters" contain the "server_max_window_bits" 931 extension parameter with a value of w, the server MUST NOT use an 932 LZ77 sliding window longer than the w-th power of 2 bytes to compress 933 messages to send. 935 8.2.2. Decompression 937 An endpoint uses the following algorithm to decompress a message. 939 1. Append 4 octets of 0x00 0x00 0xff 0xff to the tail end of the 940 payload of the message. 942 2. Decompress the resulting data using DEFLATE. 944 If the "agreed parameters" contain the "server_no_context_takeover" 945 extension parameter, the client MAY decompress each new message with 946 an empty LZ77 sliding window. Otherwise, the client MUST decompress 947 each new message using the LZ77 sliding window used to process the 948 last compressed message. 950 If the "agreed parameters" contain the "client_no_context_takeover" 951 extension parameter, the server MAY decompress each new message with 952 an empty LZ77 sliding window. Otherwise, the server MUST decompress 953 each new message using the LZ77 sliding window used to process the 954 last compressed message. Note that even if the client has included 955 the "client_no_context_takeover" extension parameter in its offer, 956 the server MUST decompress each new message using the LZ77 sliding 957 window used to process the last compressed message if the "agreed 958 parameters" don't contain the "client_no_context_takeover" extension 959 parameter. The client-to-server "client_no_context_takeover" 960 extension parameter is just a hint for the server to build an 961 extension negotiation response. 963 If the "agreed parameters" contain the "server_max_window_bits" 964 extension parameter with a value of w, the client MAY reduce the size 965 of its LZ77 sliding window to decompress received messages down to 966 the w-th power of 2 bytes. Otherwise, the client MUST use a 32,768 967 byte LZ77 sliding window to decompress received messages. 969 If the "agreed parameters" contain the "client_max_window_bits" 970 extension parameter with a value of w, the server MAY reduce the size 971 of its LZ77 sliding window to decompress received messages down to 972 the w-th power of 2 bytes. Otherwise, the server MUST use a 32,768 973 byte LZ77 sliding window to decompress received messages. Note that 974 even if the client has included in its offer the 975 "client_max_window_bits" extension parameter with a value smaller 976 than one in the "agreed parameters", the client MUST use an LZ77 977 sliding window of a size that conforms the "agreed parameters" to 978 compress messages to send. The client-to-server 979 "client_max_window_bits" extension parameter is just a hint for the 980 server to build an extension negotiation response. 982 8.2.3. Examples 984 This section introduces examples of how the permessage-deflate 985 extension transforms messages. 987 8.2.3.1. A message compressed using 1 compressed DEFLATE block 989 Suppose that an endpoint sends a text message "Hello". If the 990 endpoint uses 1 compressed DEFLATE block (compressed with fixed 991 Huffman code and the "BFINAL" bit not set) to compress the message, 992 the endpoint obtains the compressed data to use for the message 993 payload as follows. 995 The endpoint compresses "Hello" into 1 compressed DEFLATE block and 996 flushes the resulting data into a byte array using an empty DEFLATE 997 block with no compression: 999 0xf2 0x48 0xcd 0xc9 0xc9 0x07 0x00 0x00 0x00 0xff 0xff 1001 By stripping 0x00 0x00 0xff 0xff from the tail end, the endpoint gets 1002 the data to use for the message payload: 1004 0xf2 0x48 0xcd 0xc9 0xc9 0x07 0x00 1006 Suppose that the endpoint sends this compressed message without 1007 fragmentation. The endpoint builds one frame by putting the whole 1008 compressed data in the payload data portion of the frame: 1010 0xc1 0x07 0xf2 0x48 0xcd 0xc9 0xc9 0x07 0x00 1012 The first 2 octets (0xc1 0x07) are the WebSocket frame header (FIN=1, 1013 RSV1=1, RSV2=0, RSV3=0, opcode=text, MASK=0, Payload length=7). The 1014 following figure shows what value is set in each field of the 1015 WebSocket frame header. 1017 0 1 1018 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 1019 +-+-+-+-+-------+-+-------------+ 1020 |F|R|R|R| opcode|M| Payload len | 1021 |I|S|S|S| |A| | 1022 |N|V|V|V| |S| | 1023 | |1|2|3| |K| | 1024 +-+-+-+-+-------+-+-------------+ 1025 |1|1|0|0| 1 |0| 7 | 1026 +-+-+-+-+-------+-+-------------+ 1028 Suppose that the endpoint sends the compressed message with 1029 fragmentation. The endpoint splits the compressed data into 1030 fragments and builds frames for each fragment. For example, if the 1031 fragments are 3 and 4 octet, the first frame is: 1033 0x41 0x03 0xf2 0x48 0xcd 1035 and the second frame is: 1037 0x80 0x04 0xc9 0xc9 0x07 0x00 1039 Note that the RSV1 bit is set only on the first frame. 1041 8.2.3.2. Sharing LZ77 Sliding Window 1043 Suppose that a client has sent a message "Hello" as a compressed 1044 message and will send the same message "Hello" again as a compressed 1045 message. 1047 0xf2 0x48 0xcd 0xc9 0xc9 0x07 0x00 1049 The above is the payload of the first message that the client has 1050 sent. If the "agreed parameters" contain the 1051 "client_no_context_takeover" extension parameter, the client 1052 compresses the payload of the next message into the same bytes (if 1053 the client uses the same "BTYPE" value and "BFINAL" value). So, the 1054 payload of the second message will be: 1056 0xf2 0x48 0xcd 0xc9 0xc9 0x07 0x00 1058 If the "agreed parameters" did not contain the 1059 "client_no_context_takeover" extension parameter, the client can 1060 compress the payload of the next message into less bytes by 1061 referencing the history in the LZ77 sliding window. So, the payload 1062 of the second message will be: 1064 0xf2 0x00 0x11 0x00 0x00 1066 So, 2 bytes are saved in total. 1068 Note that even if some uncompressed messages (with the RSV1 bit 1069 unset) are inserted between the two "Hello" messages, they don't 1070 affect the LZ77 sliding window. 1072 8.2.3.3. Using a DEFLATE Block with No Compression 1074 0xc1 0x0b 0x00 0x05 0x00 0xfa 0xff 0x48 0x65 0x6c 0x6c 0x6f 0x00 1076 This is a frame constituting a text message "Hello" built using a 1077 DEFLATE block with no compression. The first 2 octets (0xc1 0x0b) 1078 are the WebSocket frame header (FIN=1, RSV1=1, RSV2=0, RSV3=0, 1079 opcode=text, MASK=0, Payload length=7). Note that the RSV1 bit is 1080 set for this message (only on the first fragment if the message is 1081 fragmented) because the RSV1 bit is set when DEFLATE is applied to 1082 the message, including the case when only DEFLATE blocks with no 1083 compression are used. The 3rd to 13th octets consist the payload 1084 data containing "Hello" compressed using a DEFLATE block with no 1085 compression. 1087 8.2.3.4. Using a DEFLATE Block with BFINAL Set to 1 1089 On platforms on which the flush method using an empty DEFLATE block 1090 with no compression is not available, implementors can choose to 1091 flush data using DEFLATE blocks with "BFINAL" set to 1. 1093 0xf3 0x48 0xcd 0xc9 0xc9 0x07 0x00 0x00 1095 This is the payload of a message containing "Hello" compressed using 1096 a DEFLATE block with "BFINAL" set to 1. The first 7 octets 1097 constitute a DEFLATE block with "BFINAL" set to 1 and "BTYPE" set to 1098 01 containing "Hello". The last 1 octet (0x00) contains the header 1099 bits with "BFINAL" set to 0 and "BTYPE" set to 00, and 5 padding bits 1100 of 0. This octet is necessary to allow the payload to be 1101 decompressed in the same manner as messages flushed using DEFLATE 1102 blocks with BFINAL unset. 1104 8.2.3.5. Two DEFLATE Blocks in 1 Message 1106 Two or more DEFLATE blocks may be used in 1 message. 1108 0xf2 0x48 0x05 0x00 0x00 0x00 0xff 0xff 0xca 0xc9 0xc9 0x07 0x00 1110 The first 3 octets (0xf2 0x48 0x05) and the least significant two 1111 bits of the 4th octet (0x00) constitute one DEFLATE block with 1112 "BFINAL" set to 0 and "BTYPE" set to 01 containing "He". The rest of 1113 the 4th octet contains the header bits with "BFINAL" set to 0 and 1114 "BTYPE" set to 00, and the 3 padding bits of 0. Together with the 1115 following 4 octets (0x00 0x00 0xff 0xff), the header bits constitute 1116 an empty DEFLATE block with no compression. A DEFLATE block 1117 containing "llo" follows the empty DEFLATE block. 1119 8.2.3.6. Generating an Empty Fragment Manually 1121 Suppose that an endpoint is sending data of unknown size. The 1122 endpoint may encounter the end of data signal from the data source 1123 when its buffer for uncompressed data is empty. In such a case, the 1124 endpoint just needs to send the last fragment with FIN bit set to 1 1125 and payload set to DEFLATE block(s) which contains 0 bytes of data. 1126 If the compression library being used doesn't generate any data when 1127 its buffer is empty, an empty uncompressed DEFLATE block can be built 1128 manually and used for this purpose as follows: 1130 0x00 1132 The only octet 0x00 contains the header bits with "BFINAL" set to 0 1133 and "BTYPE" set to 00, and 5 padding bits of 0. 1135 8.3. Implementation Notes 1137 On most common software development platforms, the DEFLATE 1138 compression library provides a method for aligning compressed data to 1139 byte boundaries using an empty DEFLATE block with no compression. 1140 For example, Zlib [Zlib] does this when "Z_SYNC_FLUSH" is passed to 1141 the deflate function. 1143 Some platforms may provide only methods to output and process 1144 compressed data with a ZLIB header and an Adler-32 checksum. On such 1145 platforms, developers need to write stub code to remove and 1146 complement them manually. 1148 To obtain a useful compression ratio, an LZ77 sliding window size of 1149 1,024 or more is RECOMMENDED. 1151 If a side disallows context takeover, its endpoint can easily figure 1152 out whether a certain message will be shorter if compressed or not. 1153 Otherwise, it's not easy to know whether future messages will benefit 1154 from having a certain message compressed. Implementors may employ 1155 some heuristics to determine this. 1157 8.4. Intermediaries 1159 When an intermediary forwards a message, the intermediary MAY change 1160 the compression of messages provided that the resulting sequence of 1161 messages conforms to the constraints based on the "agreed 1162 parameters". For example, an intermediary may decompress a received 1163 message, unset the "Per-message Compressed" bit and forward it to the 1164 other peer. Since such a compression change may affect the LZ77 1165 sliding window, the intermediary may need to parse and transform the 1166 following messages, too. 1168 9. Security Considerations 1170 There is a known exploit when history-based compression is combined 1171 with a secure transport [CRIME]. Implementors should pay attention 1172 to this point when integrating this extension with other extensions 1173 or protocols. 1175 10. IANA Considerations 1177 10.1. Registration of the "permessage-deflate" WebSocket Extension Name 1179 This section describes a WebSocket extension name registration in the 1180 WebSocket Extension Name Registry [RFC6455]. 1182 Extension Identifier 1183 permessage-deflate 1185 Extension Common Name 1186 WebSocket Per-message Deflate 1188 Extension Definition 1189 This document. 1191 Known Incompatible Extensions 1192 None 1194 The "permessage-deflate" extension name is used in the 1195 "Sec-WebSocket-Extensions" header in the WebSocket opening handshake 1196 to negotiate use of the permessage-deflate extension. 1198 10.2. Registration of the "Per-message Compressed" WebSocket Framing 1199 Header Bit 1201 This section describes a WebSocket framing header bit registration in 1202 the WebSocket Framing Header Bits Registry [RFC6455]. 1204 Header Bit 1205 RSV1 1207 Common Name 1208 Per-message Compressed 1210 Meaning 1211 The message is compressed or not. 1213 Reference 1214 Section 6 of this document. 1216 The "Per-message Compressed" framing header bit is used on the first 1217 fragment of data messages to indicate whether the payload of the 1218 message is compressed by the PMCE or not. 1220 11. Acknowledgements 1222 Special thanks to Patrick McManus who wrote up the initial 1223 specification of a DEFLATE-based compression extension for the 1224 WebSocket Protocol to which I referred to write this specification. 1226 Thank you to the following people who participated in discussions on 1227 the HyBi WG and contributed ideas and/or provided detailed reviews 1228 (the list is likely to be incomplete): Adam Rice, Alexander 1229 Philippou, Alexey Melnikov, Arman Djusupov, Bjoern Hoehrmann, Brian 1230 McKelvey, Dario Crivelli, Greg Wilkins, Inaki Baz Castillo, Jamie 1231 Lokier, Joakim Erdfelt, John A. Tamplin, Julian Reschke, Kenichi 1232 Ishibashi, Mark Nottingham, Peter Thorson, Roberto Peon, Salvatore 1233 Loreto, Simone Bordet, Tobias Oberstein and Yutaka Hirano. Note that 1234 people listed above didn't necessarily endorse the end result of this 1235 work. 1237 12. References 1239 12.1. Normative References 1241 [RFC1951] Deutsch, P., "DEFLATE Compressed Data Format Specification 1242 version 1.3", RFC 1951, May 1996. 1244 [RFC5234] Crocker, D. and P. Overell, "Augmented BNF for Syntax 1245 Specifications: ABNF", STD 68, RFC 5234, January 2008. 1247 [RFC6455] Fette, I. and A. Melnikov, "The WebSocket Protocol", 1248 RFC 6455, December 2011. 1250 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 1251 Requirement Levels", BCP 14, RFC 2119, March 1997. 1253 [LZ77] Ziv, J. and A. Lempel, "A Universal Algorithm for 1254 Sequential Data Compression", IEEE Transactions on 1255 Information Theory, Vol. 23, No. 3, pp. 337-343. 1257 12.2. Informative References 1259 [RFC1979] Woods, J., "PPP Deflate Protocol", RFC 1979, August 1996. 1261 [Zlib] Gailly, J. and M. Adler, "Zlib", . 1263 [CRIME] Rizzo, J. and T. Duong, "The CRIME attack", Ekoparty 2012, 1264 September 2012. 1266 Author's Address 1268 Takeshi Yoshino 1269 Google, Inc. 1271 Email: tyoshino@google.com