Re: [hybi] Is it important to know frame length at the start of frame? (was: Re: Discontinuation of mux ...)
Joakim Erdfelt <joakim@intalio.com> Tue, 18 February 2014 18:12 UTC
Return-Path: <joakim@intalio.com>
X-Original-To: hybi@ietfa.amsl.com
Delivered-To: hybi@ietfa.amsl.com
Received: from localhost (ietfa.amsl.com [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 549DC1A0512 for <hybi@ietfa.amsl.com>; Tue, 18 Feb 2014 10:12:11 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -0.777
X-Spam-Level:
X-Spam-Status: No, score=-0.777 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, FM_FORGED_GMAIL=0.622, HTML_MESSAGE=0.001, J_CHICKENPOX_64=0.6, J_CHICKENPOX_75=0.6, RCVD_IN_DNSWL_LOW=-0.7] autolearn=no
Received: from mail.ietf.org ([4.31.198.44]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Uz2HvgHGbHli for <hybi@ietfa.amsl.com>; Tue, 18 Feb 2014 10:12:09 -0800 (PST)
Received: from mail-ee0-f51.google.com (mail-ee0-f51.google.com [74.125.83.51]) by ietfa.amsl.com (Postfix) with ESMTP id E158B1A010A for <hybi@ietf.org>; Tue, 18 Feb 2014 10:12:08 -0800 (PST)
Received: by mail-ee0-f51.google.com with SMTP id b57so7911955eek.24 for <hybi@ietf.org>; Tue, 18 Feb 2014 10:12:05 -0800 (PST)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=YOe6xTNWLP2dBaA7PZU9J0FUsCT8jDc7FTbgZQfQTi4=; b=mQoQR3yuHjQWpwrGK7STilPDfXgAXKb/QUZh0ERyNQ+rh3IpfakaB2q2pqjav/ncsz ydOiRpUL5HK+Y3vfqf8POrOuSKlcfYx4P+6EIrJQQf+CFnkGKInTliMvuy9f5UQT0UY4 CVqFVS1QF9qgmtZQ3ojTM9XYvQWLJjjj8D3vwBhynchA+zj8XPJpv+ndv8JfIkEZAt5g SeqJvLkIiUjCaCQ2FKIxrd4Ok9BxJFtbujhDX0SkbPNYvrm0yHoaao6f/VT0D01hVSKy ENo59rNGJeOOey7AqO96ADFR/GCG/VA0w4U4ADNGROXCEMbIfFQgC4sYp2x/rVWqtSH4 peVQ==
X-Gm-Message-State: ALoCoQkAcZA42MJx8N0NnBjWciJsp32LCng09Sy2639nLyQI4TK4cnfAcWWUS7QOKtn8lrAQ/Cs7
MIME-Version: 1.0
X-Received: by 10.14.119.197 with SMTP id n45mr225572eeh.93.1392747125485; Tue, 18 Feb 2014 10:12:05 -0800 (PST)
Received: by 10.14.152.202 with HTTP; Tue, 18 Feb 2014 10:12:05 -0800 (PST)
In-Reply-To: <CAG4zZZC1cmaH36znAvVLZE_MyJ+ThNk1Ky7tQ-QnKf_qwiQNDw@mail.gmail.com>
References: <CAH9hSJbf_ABT7ECL9eS=_ADrncX8qBtxZv=uLcdu9_6GUv23Uw@mail.gmail.com> <CACuKZqEcA1Pv8RpWfmThMjTzi2BbVMMKXqujs6BxVfxRPZJ9NQ@mail.gmail.com> <CAG4zZZCr4aTfVpw2coX2g0qw++4kdgNCFVze6tHKZ+fJNqb0aQ@mail.gmail.com> <CAG4zZZA4WR50Ea2e36XEgTgpJURwiMFn+DXeYuxHFfZatYzDOQ@mail.gmail.com> <CAH9hSJYv5VXGjS7AfG12-ArEvE6Uj_eE6pPxAiQcchcgV8vHcg@mail.gmail.com> <CAH9hSJbzra7uz7yfKQwfZaP_jhnxwdZyx8JnwCmBGhiMk6rbtg@mail.gmail.com> <CAG4zZZC1cmaH36znAvVLZE_MyJ+ThNk1Ky7tQ-QnKf_qwiQNDw@mail.gmail.com>
Date: Tue, 18 Feb 2014 11:12:05 -0700
Message-ID: <CAG4zZZB3h6TTFLUp-ucYQP7tMf-8=h5fh1UqufMh3w-0JN+hSw@mail.gmail.com>
From: Joakim Erdfelt <joakim@intalio.com>
To: Takeshi Yoshino <tyoshino@google.com>
Content-Type: multipart/alternative; boundary="001a1132f7f8ad47f604f2b23516"
Archived-At: http://mailarchive.ietf.org/arch/msg/hybi/TT5IoAC35d4Y6GN3kIler_LSSPg
Cc: "hybi@ietf.org" <hybi@ietf.org>
Subject: Re: [hybi] Is it important to know frame length at the start of frame? (was: Re: Discontinuation of mux ...)
X-BeenThere: hybi@ietf.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: Server-Initiated HTTP <hybi.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/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: Tue, 18 Feb 2014 18:12:11 -0000
Clicked too soon on that pseudo code. This is more clear. (i hope) header = frame.parse_header(network_bytes) if (header.size > system_memory_constraints) then fail_protocol(1009) // do not read payload return end if (message.size + header.size > message.max_constraints) then fail_protocol(1009) // do not read payload return else payload = frame.read_payload(network_bytes) message.append(payload) end if (header.fin == true) then message.deliver_to(local_endpoint) // free up any message resources, reset message size to 0 message.reset end -- Joakim Erdfelt <joakim@intalio.com> webtide.com <http://www.webtide.com/> - intalio.com/jetty Expert advice, services and support from from the Jetty & CometD experts eclipse.org/jetty - cometd.org On Tue, Feb 18, 2014 at 11:08 AM, Joakim Erdfelt <joakim@intalio.com> wrote: > I'm not sure I was clear, as you seem to still have questions and are > hinting at alternatives. > > The most important thing I said: > The size is important at the start of any payload about to be received. > > All other statements are based off of that. > The nuanced questions you are asking seems to indicate that you treat a > frame differently than a message is irrelevant. > If the frame happens to represent a complete message (eg: > opcode=(text|binary) + fin=true) vs being only 1 frame belonging to a > series of frames that make up a whole message makes no difference to the > statement. > > Since websocket is message based, not stream based, the above core > statement remains true. > > The fail-fast example applies for fragmented or whole messages. > > some pseudo code: > > header = frame.parse_header(network_bytes) > if (header.size > system_memory_constraints) then > fail_protocol(1009) > return > end > // is message still being collected and not yet delivered to local > endpoint? > if (message.delivered == false) then > if (message.size + header.size > message.max_constraints) then > fail_protocol(1009) > return > else > payload = frame.read_payload(network_bytes) > message.append(payload) > end > end > if (header.fin == true) then > message.deliver_to(local_endpoint) > message.reset > end > > > -- > Joakim Erdfelt <joakim@intalio.com> > webtide.com <http://www.webtide.com/> - intalio.com/jetty > Expert advice, services and support from from the Jetty & CometD experts > eclipse.org/jetty - cometd.org > > > On Mon, Feb 17, 2014 at 10:37 PM, Takeshi Yoshino <tyoshino@google.com>wrote: > >> So, to be clear, Joakim, you're not objecting to make it unable to know >> the size of each frame, but objecting to make it completely unable to know >> the size of big messages on receiving the head of it, right? >> >> Your use case (fail-fast) seems to require the sender to send messages >> unfragmented. So, it sounds like application (or kind of application) >> specific needs. You could do some application specific hack such as >> introducing "complete-message-size" header in the payload than depending on >> protocol level length header. If not, clients in the wild which are out of >> your control may do arbitrary fragmentation. FYI, Chromium's WebSocket >> stack is being refactored and after that it starts sending big messages as >> fragmented into small frames. >> > >
- Re: [hybi] Is it important to know frame length a… Zhong Yu
- Re: [hybi] Is it important to know frame length a… Joakim Erdfelt
- Re: [hybi] Is it important to know frame length a… Peter Thorson
- Re: [hybi] Is it important to know frame length a… Joakim Erdfelt
- Re: [hybi] Is it important to know frame length a… Takeshi Yoshino
- [hybi] Is it important to know frame length at th… Takeshi Yoshino
- Re: [hybi] Is it important to know frame length a… Micheil Smith
- Re: [hybi] Is it important to know frame length a… Joakim Erdfelt
- Re: [hybi] Is it important to know frame length a… Zhong Yu
- Re: [hybi] Is it important to know frame length a… Peter Thorson
- Re: [hybi] Is it important to know frame length a… Zhong Yu
- Re: [hybi] Is it important to know frame length a… Zhong Yu
- Re: [hybi] Is it important to know frame length a… Tobias Oberstein
- Re: [hybi] Is it important to know frame length a… Zhong Yu
- Re: [hybi] Is it important to know frame length a… Takeshi Yoshino
- Re: [hybi] Is it important to know frame length a… Takeshi Yoshino
- Re: [hybi] Is it important to know frame length a… Joakim Erdfelt
- Re: [hybi] Is it important to know frame length a… Joakim Erdfelt
- Re: [hybi] Is it important to know frame length a… Takeshi Yoshino
- Re: [hybi] Is it important to know frame length a… Takeshi Yoshino
- Re: [hybi] Is it important to know frame length a… Joakim Erdfelt
- Re: [hybi] Is it important to know frame length a… Roberto Peon
- Re: [hybi] Is it important to know frame length a… Zhong Yu
- Re: [hybi] Is it important to know frame length a… Zhong Yu
- Re: [hybi] Is it important to know frame length a… Roberto Peon
- Re: [hybi] Is it important to know frame length a… Zhong Yu
- Re: [hybi] Is it important to know frame length a… Takeshi Yoshino
- Re: [hybi] Is it important to know frame length a… Takeshi Yoshino