Re: [hybi] With deflate-stream, Close frame doesn't work as an end of data marker
Takeshi Yoshino <tyoshino@google.com> Thu, 10 March 2011 12:34 UTC
Return-Path: <tyoshino@google.com>
X-Original-To: hybi@core3.amsl.com
Delivered-To: hybi@core3.amsl.com
Received: from localhost (localhost [127.0.0.1]) by core3.amsl.com (Postfix) with ESMTP id 268C53A6936 for <hybi@core3.amsl.com>; Thu, 10 Mar 2011 04:34:07 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -105.765
X-Spam-Level:
X-Spam-Status: No, score=-105.765 tagged_above=-999 required=5 tests=[AWL=0.211, BAYES_00=-2.599, FM_FORGED_GMAIL=0.622, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_MED=-4, USER_IN_WHITELIST=-100]
Received: from mail.ietf.org ([64.170.98.32]) by localhost (core3.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id gjVmVikhoofP for <hybi@core3.amsl.com>; Thu, 10 Mar 2011 04:34:03 -0800 (PST)
Received: from smtp-out.google.com (smtp-out.google.com [216.239.44.51]) by core3.amsl.com (Postfix) with ESMTP id C854C3A6952 for <hybi@ietf.org>; Thu, 10 Mar 2011 04:34:02 -0800 (PST)
Received: from kpbe11.cbf.corp.google.com (kpbe11.cbf.corp.google.com [172.25.105.75]) by smtp-out.google.com with ESMTP id p2ACZJhZ026866 for <hybi@ietf.org>; Thu, 10 Mar 2011 04:35:19 -0800
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=google.com; s=beta; t=1299760519; bh=BhzRlYAQYzUvfJWqk8mT4cxsZhI=; h=MIME-Version:In-Reply-To:References:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=WYHmNhoksCBVg4dZIIGX2tE/RL8m3W9ou9DukuOwkerTu6oNWvSpTdLzEbgny5bMB hVVhePtImjW3WgvWGATNA==
Received: from iwl42 (iwl42.prod.google.com [10.241.67.234]) by kpbe11.cbf.corp.google.com with ESMTP id p2ACZIEO001435 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=NOT) for <hybi@ietf.org>; Thu, 10 Mar 2011 04:35:18 -0800
Received: by iwl42 with SMTP id 42so2013130iwl.0 for <hybi@ietf.org>; Thu, 10 Mar 2011 04:35:18 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=beta; h=domainkey-signature:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc:content-type; bh=jBrPL5BiA6QCNTsdTqTxZcRq7s9lzH5YCJ6itAnovY0=; b=WyM5z4vxH5KwNrE6LwQ8yRcvhky5Y0IJZnHsezHDL0IxbQbtvsUWX5BIOJxvE3trAj LaaldGrsOkGIeeRTmYsw==
DomainKey-Signature: a=rsa-sha1; c=nofws; d=google.com; s=beta; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; b=pI2UidAMA/P/heOGYc7epy7+OQZMQXN5cWDkUTm7UqwETGEWkjcF+aRCNKfCZaAQG7 XGZQ9cxwHvmAa5mWKvYg==
Received: by 10.231.193.170 with SMTP id du42mr6083754ibb.15.1299760518133; Thu, 10 Mar 2011 04:35:18 -0800 (PST)
MIME-Version: 1.0
Received: by 10.231.14.141 with HTTP; Thu, 10 Mar 2011 04:34:57 -0800 (PST)
In-Reply-To: <4D78C12C.1080108@warmcat.com>
References: <OF4821AA00.120197B4-ON8825784E.0076F791-8825784E.00781253@playstation.sony.com> <4D77FB84.9010104@warmcat.com> <AANLkTin+JizCJ-tgr1bxTygaT_2ueT910JByq9BYGncS@mail.gmail.com> <4D789223.8010208@warmcat.com> <AANLkTikabAwUv5g=F7OHjmGy_rei=jCGhr8ypiGP8sdO@mail.gmail.com> <4D78C12C.1080108@warmcat.com>
From: Takeshi Yoshino <tyoshino@google.com>
Date: Thu, 10 Mar 2011 21:34:57 +0900
Message-ID: <AANLkTi=eujUtQY64Uoo0ymTM013hT-ebMb8j-cXF6m9i@mail.gmail.com>
To: Andy Green <andy@warmcat.com>
Content-Type: multipart/alternative; boundary="0050450171e1f9f7d2049e201386"
X-System-Of-Record: true
Cc: Yutaka_Takeda@playstation.sony.com, hybi@ietf.org
Subject: Re: [hybi] With deflate-stream, Close frame doesn't work as an end of data marker
X-BeenThere: hybi@ietf.org
X-Mailman-Version: 2.1.9
Precedence: list
List-Id: Server-Initiated HTTP <hybi.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/listinfo/hybi>, <mailto:hybi-request@ietf.org?subject=unsubscribe>
List-Archive: <http://www.ietf.org/mail-archive/web/hybi>
List-Post: <mailto:hybi@ietf.org>
List-Help: <mailto:hybi-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/hybi>, <mailto:hybi-request@ietf.org?subject=subscribe>
X-List-Received-Date: Thu, 10 Mar 2011 12:34:07 -0000
On Thu, Mar 10, 2011 at 21:16, Andy Green <andy@warmcat.com> wrote: > On <03%2F10%2F2011>03/10/2011 12:12 PM, Somebody in the thread at some > point said: > > Hi - > > Also one note on Yoshino's language to describe the compression >> actions it mixes Z_ nomenclature that zlib uses and hex packets on >> the wire, if this hex trailer that he mentions is a byproduct of >> Z_FINISH or whatever it might be clearer to an implementer that he >> can generate it like that and forget mentioning magic hex. >> >> >> Basically I agree your point here that we should use only deflate >> terminology in definition, and append implementation note to it using >> zlib nomenclature, while avoiding mentioning magic hex as you say. >> >> In my proposal >> (http://www.ietf.org/mail-archive/web/hybi/current/msg06642.html the >> bottom of the message), I used one magic hex "0x00 0x00 0xff 0xff" to >> include optimization on deflate adopted by PPP and explain what >> implementor have to do quickly. That can be changed to ... something >> like "0 byte length block with BTYPE=00 excluding headers", but it's not >> helpful in this context IMO. This is originally a part of byproduct of >> zlib's de-facto standard way to flush deflated stream, but operation >> introduced by RFC 1979 like cutting, removing on sender, re-appending >> the bytes on receiver is out of scope of RFC1951. Maybe, just referring >> RFC1979 in the explanation of receiver's action would be fine? >> > > Well my issue with it was I don't know what code to write as described, it > sounds like I should fill up a four byte bufer with constants and write() it > out. > > I guess all the actions fall into simple zlib calls with the right Z_ > flags, eg, it really means you must call the last guy with Z_FINISH. However > else it's described it'll be helpful to implementers to give examples where > it isn't clear in Z_ nomenclature as well. > > -Andy > OK. So we can add an implementation note like this. Senders using this extension MUST apply RFC 1951 DEFLATE to all the bytes of > the application data portion of data frames. Senders MAY include multiple > blocks in a frame. Senders MAY use blocks of any type as defined in RFC > 1951. Senders MUST use the algorithm described in Section 2.1 of RFC1979 to > align compressed data to byte boundary. Senders MAY keep using the same LZ77 > sliding window for multiple frames. If you're using zlib for applying DEFLATE compression, specify Z_SYNC_FLUSH when you flush the last octets of application data for each frame (in case the last block is non-compressed block (BTYPE=00), append one empty compressed block (BTYPE=01)), and then strip the last 4 octets from the compressed octets. Receivers MUST append 0x00 0x00 0xff 0xff to the application data portion > and decompress it using DEFLATE to decode the original application data. > Receivers MUST keep using the same LZ77 sliding window for all the frames of > the same WebSocket connection. Receivers MUST assume the senders use 32768 > byte LZ77 sliding window. If you're using zlib for applying DEFLATE compression, for each received frame, concatenate 4 octets 0x00 0x00 0xff 0xff and the application data, and then supply the resulting bytes to zlib and use the uncompressed data. ---- There might be some function prepared on zlib that performs these procedure, but I don't know that (i'm not so familiar with the original C lang zlib). And, e.g. zlib wrapper of Python which I'm using to write WebSocket server doesn't expose such method at all. I thought simple uncompress/compress/flush methods are at least available on most of platforms and built this text.
- [hybi] With deflate-stream, Close frame doesn't w… Takeshi Yoshino
- Re: [hybi] With deflate-stream, Close frame doesn… Yutaka_Takeda
- Re: [hybi] With deflate-stream, Close frame doesn… Takeshi Yoshino
- Re: [hybi] With deflate-stream, Close frame doesn… Yutaka_Takeda
- Re: [hybi] With deflate-stream / websocket tracer… Andy Green
- Re: [hybi] With deflate-stream, Close frame doesn… Takeshi Yoshino
- Re: [hybi] With deflate-stream, Close frame doesn… Yutaka_Takeda
- Re: [hybi] With deflate-stream / websocket tracer… John Tamplin
- Re: [hybi] With deflate-stream / websocket tracer… Andy Green
- Re: [hybi] With deflate-stream, Close frame doesn… Greg Wilkins
- Re: [hybi] With deflate-stream, Close frame doesn… John Tamplin
- Re: [hybi] With deflate-stream, Close frame doesn… Greg Wilkins
- Re: [hybi] With deflate-stream, Close frame doesn… Brian McKelvey
- Re: [hybi] With deflate-stream, Close frame doesn… Yutaka_Takeda
- Re: [hybi] With deflate-stream, Close frame doesn… Yutaka_Takeda
- Re: [hybi] With deflate-stream, Close frame doesn… Andy Green
- Re: [hybi] With deflate-stream, Close frame doesn… Takeshi Yoshino
- Re: [hybi] With deflate-stream, Close frame doesn… Andy Green
- Re: [hybi] With deflate-stream, Close frame doesn… Takeshi Yoshino
- Re: [hybi] With deflate-stream, Close frame doesn… Andy Green
- Re: [hybi] With deflate-stream, Close frame doesn… Takeshi Yoshino
- Re: [hybi] With deflate-stream, Close frame doesn… Yutaka_Takeda
- Re: [hybi] With deflate-stream, Close frame doesn… Andy Green
- Re: [hybi] With deflate-stream, Close frame doesn… Ian Fette (イアンフェッティ)
- [hybi] change in 07: Payload only compression ext… Salvatore Loreto
- Re: [hybi] change in 07: Payload only compression… Ian Fette (イアンフェッティ)
- Re: [hybi] change in 07: Payload only compression… Brian
- Re: [hybi] With deflate-stream, Close frame doesn… Andy Green
- [hybi] TCP packet boundaries must not be assumed … Jamie Lokier
- Re: [hybi] With deflate-stream, Close frame doesn… Jamie Lokier
- Re: [hybi] With deflate-stream, Close frame doesn… Takeshi Yoshino
- Re: [hybi] With deflate-stream, Close frame doesn… Andy Green
- Re: [hybi] TCP packet boundaries must not be assu… Andy Green
- Re: [hybi] With deflate-stream, Close frame doesn… Takeshi Yoshino
- Re: [hybi] With deflate-stream, Close frame doesn… John Tamplin
- Re: [hybi] With deflate-stream, Close frame doesn… Takeshi Yoshino