Re: [hybi] With deflate-stream, Close frame doesn't work as an end of data marker

Takeshi Yoshino <tyoshino@google.com> Wed, 09 March 2011 12:14 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 02D763A69A0 for <hybi@core3.amsl.com>; Wed, 9 Mar 2011 04:14:00 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -105.476
X-Spam-Level:
X-Spam-Status: No, score=-105.476 tagged_above=-999 required=5 tests=[AWL=0.500, 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 HMy-3BbILGTy for <hybi@core3.amsl.com>; Wed, 9 Mar 2011 04:13:59 -0800 (PST)
Received: from smtp-out.google.com (smtp-out.google.com [74.125.121.67]) by core3.amsl.com (Postfix) with ESMTP id 00B7F3A69A2 for <hybi@ietf.org>; Wed, 9 Mar 2011 04:13:57 -0800 (PST)
Received: from wpaz37.hot.corp.google.com (wpaz37.hot.corp.google.com [172.24.198.101]) by smtp-out.google.com with ESMTP id p29CEY82015144 for <hybi@ietf.org>; Wed, 9 Mar 2011 04:15:13 -0800
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=google.com; s=beta; t=1299672913; bh=JbnPmorDT0vE98XDecPpkr6AlFo=; h=MIME-Version:In-Reply-To:References:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=GHuPva1xd9A/kQVWtMMFBcoOOJ0CO9vx1CN1cMk8M1n2LLXh94TMm3ZiaX0kCelpo +UGAlxDEb1osy75/OlKnQ==
Received: from iyj8 (iyj8.prod.google.com [10.241.51.72]) by wpaz37.hot.corp.google.com with ESMTP id p29C5Vxn017278 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=NOT) for <hybi@ietf.org>; Wed, 9 Mar 2011 04:06:55 -0800
Received: by iyj8 with SMTP id 8so414917iyj.9 for <hybi@ietf.org>; Wed, 09 Mar 2011 04:06:55 -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=bv+gR/L/0/g4dKGa+3A2EN6hf+UlPLXDMOx13AUndbE=; b=jkyC2tke89KTfA4Wnxu9Z7IBpvA9DULnDDRcnh8DWio0cma3QdbhIGq4tmH7B2NSu2 BJkmRZpW8Kq9Xvwd1ofA==
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=EO2axczDWmo94se/yeTyOwYfWwpd594oEaC8CEZudZK8K4J5x+ZVf3lqxx9x0LlOPT rWNfMdOz3qkQcy4IbRRg==
Received: by 10.43.61.20 with SMTP id wu20mr7840621icb.371.1299672415177; Wed, 09 Mar 2011 04:06:55 -0800 (PST)
MIME-Version: 1.0
Received: by 10.231.14.141 with HTTP; Wed, 9 Mar 2011 04:06:35 -0800 (PST)
In-Reply-To: <4D775D69.8010808@warmcat.com>
References: <OF27A0495D.2C32912B-ON8825784E.00342DCE-8825784E.00367A85@playstation.sony.com> <4D775D69.8010808@warmcat.com>
From: Takeshi Yoshino <tyoshino@google.com>
Date: Wed, 09 Mar 2011 21:06:35 +0900
Message-ID: <AANLkTi=4_jp_=QffTsTbrUxjzGTRTv5F4Ao=5ZBpc2FB@mail.gmail.com>
To: Andy Green <andy@warmcat.com>
Content-Type: multipart/alternative; boundary="bcaec51a8338a18ac5049e0b9096"
X-System-Of-Record: true
Cc: hybi@ietf.org, Yutaka_Takeda@playstation.sony.com
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: Wed, 09 Mar 2011 12:14:00 -0000

On Wed, Mar 9, 2011 at 19:58, Andy Green <andy@warmcat.com> wrote:

> On 03/09/2011 09:55 AM, Somebody in the thread at some point said:
>
>>
>> This thread, too, I am wondering if this has reached a consensus at this
>> point. At least,
>> Greg, Brian and myself agreed to have only payload deflated. This aligns
>> with the
>>
>
> I'd be a bit happier with payload-only compression but I don't really mind.
>  It's a little bit less deadly than masking-outside-framing because you can
> at least turn off negotiation of compression inside the standard OK if you
> want to debug it.
>
>

I prefer in-frame compression, too.

I sent out a proposal
http://www.ietf.org/mail-archive/web/hybi/current/msg06642.html last week.
It's similar to what Yutaka explained in this thread. Comments are welcome.


>  reasons for choosing masking in frames, too. Also, it resolves the
>> original issue Takeshi
>> pointed out with regards to presence of trailing bytes after Close frame
>> as in the subject
>> which would cause RST in normal termination.
>>
>
> Having implemented this now, I don't see the problem using Z_PARTIAL_FLUSH
> as the standard seems to recommend normally, and then Z_FULL_FLUSH when
> sending the close packet, and disabling any further packet issue on that
> connection.  So I don't think Takeshi's issue is more than an implementation
> problem, I'd welcome being educated if I missed any point.
>
>
Maybe, exhaustive (to be strict, recv with big buffer) recv call in your
code drains all the deflated data arrived (everything including Huffman
codes for some preceding frames, ones for close frame, 3 bit header BFINAL=0
BTYPE=00 and 00 00 ff ff) from the TCP stack.

Yes, since it's rare that octets for a single WebSocket frame are put in
separate TCP packets and delivered to application layer separately
(requiring separate recv-call), this is not a big problem. But with in-frame
compression, it becomes perfect.


> -Andy
>
> _______________________________________________
> hybi mailing list
> hybi@ietf.org
> https://www.ietf.org/mailman/listinfo/hybi
>