Re: Design Issue: Frame Processing Model

James M Snell <> Fri, 26 April 2013 17:06 UTC

Return-Path: <>
Received: from localhost (localhost []) by (Postfix) with ESMTP id 809E821F99CC for <>; Fri, 26 Apr 2013 10:06:05 -0700 (PDT)
X-Virus-Scanned: amavisd-new at
X-Spam-Flag: NO
X-Spam-Score: -10.438
X-Spam-Status: No, score=-10.438 tagged_above=-999 required=5 tests=[AWL=0.161, BAYES_00=-2.599, RCVD_IN_DNSWL_HI=-8]
Received: from ([]) by localhost ( []) (amavisd-new, port 10024) with ESMTP id 8cKni9CY1M25 for <>; Fri, 26 Apr 2013 10:06:04 -0700 (PDT)
Received: from ( []) by (Postfix) with ESMTP id 9354521F99CA for <>; Fri, 26 Apr 2013 10:06:04 -0700 (PDT)
Received: from lists by with local (Exim 4.72) (envelope-from <>) id 1UVm5V-0001hb-I8 for; Fri, 26 Apr 2013 17:05:33 +0000
Resent-Date: Fri, 26 Apr 2013 17:05:33 +0000
Resent-Message-Id: <>
Received: from ([]) by with esmtp (Exim 4.72) (envelope-from <>) id 1UVm5Q-0001gq-B5 for; Fri, 26 Apr 2013 17:05:28 +0000
Received: from ([]) by with esmtps (TLS1.0:RSA_ARCFOUR_SHA1:16) (Exim 4.72) (envelope-from <>) id 1UVm5P-0008Os-9w for; Fri, 26 Apr 2013 17:05:28 +0000
Received: by with SMTP id eh20so3783052obb.29 for <>; Fri, 26 Apr 2013 10:05:01 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;; s=20120113; h=x-received:mime-version:in-reply-to:references:from:date:message-id :subject:to:cc:content-type; bh=n6liNQWqtMyqo1P0Tm/2/TUELAN0ft/t8BvqXUCnC7c=; b=rNylMT/2ANZqV4JsSb6camk5l3o6tBE4qDsE+cFNl46aGS+jwRSGFZGT+ThJFYnAad liSM6/AtBMnoGc/UWd7khz7w7NBnXpA6bbI+CwWYHVB3IpHZ+oDuKb6skTWCTwCVhSrr Qzg7EZ1+tfLlHIcpa9sFusZFocx1W6DvwdmY9sg8lIr7B2sINezUlmjCVosAKe63rluU h5KL2Q8rOPgVYKyRfauAfkPTffktaAVwcxiMkGzbWgPOS4nsL5zuOu9rztPyIdvZelAd o0qCFiXet4bMz3ui4jz3JEcJaxTjAleBLr/n8Q9h7impCO4w2RIvRxPmvEwNq11RNc4r rp+g==
X-Received: by with SMTP id cp6mr23273347oeb.91.1366995901317; Fri, 26 Apr 2013 10:05:01 -0700 (PDT)
MIME-Version: 1.0
Received: by with HTTP; Fri, 26 Apr 2013 10:04:41 -0700 (PDT)
In-Reply-To: <>
References: <> <>
From: James M Snell <>
Date: Fri, 26 Apr 2013 10:04:41 -0700
Message-ID: <>
To: Martin Thomson <>
Cc: "" <>
Content-Type: text/plain; charset=UTF-8
Received-SPF: pass client-ip=;;
X-W3C-Hub-Spam-Status: No, score=-3.5
X-W3C-Hub-Spam-Report: AWL=-2.675, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7, SPF_PASS=-0.001
X-W3C-Scan-Sig: 1UVm5P-0008Os-9w 5fe8173fe2c38155d04776510bbb2bba
Subject: Re: Design Issue: Frame Processing Model
Archived-At: <>
X-Mailing-List: <> archive/latest/17608
Precedence: list
List-Id: <>
List-Help: <>
List-Post: <>
List-Unsubscribe: <>

In reading through the current spec, I believe there would at least be
some value in briefly calling out the three tiers. Doing so helps in
three ways:

1. When dealing with error conditions, identifying the tiers, along
with what processing occurs in each, helps us to communicate what
steps are absolutely required. For instance, we say several times that
when a stream is half-closed in one direction, the closed end needs to
be prepared to accept frames but might be able to safely discard
those; we do not, however, ever explicitly define what it means to
"accept" a frame. This will be particularly important when dealing
with state management (header compression) and mitigation of denial of
service attacks.

2. Calling out the tiers gives us a very simple way of isolating
specific functions, such as error handling, upgrade negotiation, flow
control, header compression, stream management, etc. There is, for
instance, an open question about mixing HEADERS and DATA frames in a
single stream and allowing certain sets of HEADERS to "bleed through"
to higher levels. Defining the tiers explicitly would allow us to
speak more intelligently about where things belong.

3. Calling out the tiers gives us a more robust approach for dealing
with extensions to the protocol later on. For example, if I introduce
a new frame type at some point down the road, how does that frame type
necessarily impact the session? We've discussed in another thread that
unknown frame types ought to never require a change to session state,
which means that new frame types would never be Tier 1. New Frame
types might, however, impact things at a stream level (for instance,
imagine a checksum frame that includes a cryptographic hash of
previously sent data frames.. some bit of Tier 2 stream handling code
could automatically verify that without it ever being passed on to
Tier 3. Or, the new frame could be intended solely for the application
layer... Do we want to allow that? Honestly, I would argue that all
extension frames ought to be limited to Tier 2. Only changes to the
base protocol can introduce Tier 1 frames... if we do not call out the
Tiers explicitly, it becomes much more difficult to establish these

I believe that it should be possible to keep the description simple
and I can take a first stab at it. If, after reviewing that draft,
people think it adds too much complexity or confusion, we can drop the
silly idea ;-)

- James

On Thu, Apr 25, 2013 at 4:23 PM, Martin Thomson
<> wrote:
> Semi-formally, the Tier 2/3 division is made.  The 1/2 split hasn't been.
> We've been talking about a "framing layer", which refers to 1+2.  I
> originally thought that the distinction would be 1=framing, 2=streams,
> 3=application (http).  You can go further and split the streams layer
> into planes: control and data.  But I agree, formalism only gets you
> so far.
> Otherwise, I think that you have it.  I'm not sure whether the spec
> needs to say anything.  Maybe you could save it for the book that you
> are writing on HTTP/2.0.
> On 25 April 2013 15:28, James M Snell <> wrote:
>> At the (very real) risk of adding a bit too much formalism to the
>> Frame processing model, I have noticed a number of areas in the
>> current -02 draft where references are made to an endpoint being
>> required to receive and accept frames but being permitted to ignore
>> them if necessary, etc. There is also a concern over where exactly in
>> the processing model steps such as header compression state management
>> ought to occur, whether or not that occurs before sending RST_STREAM
>> and GOAWAY frames, etc.
>> In thinking it over, I think it would be very beneficial in the long
>> term for us to define specific processing levels or tiers for Frames.
>> Below is a strawman example:
>> Tier 1: "Session Tier"
>>   A frame received and parsed. This is where basic validation of the
>> frame syntax occurs and where state management based on frame
>> structure (e.g. compressed headers) happens. Any processing errors
>> that occur here are considered to be Session Errors and will typically
>> be related to incorrect protocol support, malformed frames, malformed
>> headers, etc. At this tier, frames are examined individually and not
>> yet processed as being part of a stream.
>> Tier 2: "Stream Tier"
>>   The next tier is to process the frame in context of a stream. This
>> is where we look at things like whether the frame has a valid known
>> stream identifier, whether the associated stream is open, half-closed,
>> closed or whatever. The errors that occur here can be Session or
>> Stream errors.
>> Tier 3: "Application Tier"
>>   The Frame data is passed on for application-level handling. All of
>> the basic parsing and stream validation has occurred already. This is
>> where we start applying HTTP specific semantics. The errors that occur
>> here are typically HTTP level errors with associated HTTP status
>> codes.
>> Given these tiers, we can then begin speaking in very concrete terms
>> about what kinds of processing may be required at different points in
>> the session lifecycle.
>> For instance:
>>  - Protocol upgrade negotiation, SETTINGS frames, GOAWAY and flow
>> control are all handled in Tier 1. None of that ever passes on to
>> higher tiers.
>>  - When we say things like, "an endpoint MUST be continue to accept
>> frames after a RST_STREAM", we're really saying that Tier 1 processing
>> must still occur, but that frames may not have to be passed on to Tier
>> 2
>>  - When we deal with HTTP specific semantics, we assume that all of
>> the Tier 1 and Tier 2 processing has been dealt with
>> I believe these layers already informally exist in the model we have,
>> even if it's not entirely obvious in the current design.
>> - James