Re: [hybi] Subprotocol semantics. How SHOULD/MUST user-agent and server deal with it

Takeshi Yoshino <tyoshino@google.com> Wed, 25 May 2011 08:05 UTC

Return-Path: <tyoshino@google.com>
X-Original-To: hybi@ietfa.amsl.com
Delivered-To: hybi@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 0BC64E06D6 for <hybi@ietfa.amsl.com>; Wed, 25 May 2011 01:05:07 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -105.976
X-Spam-Level:
X-Spam-Status: No, score=-105.976 tagged_above=-999 required=5 tests=[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.30]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id KQeCRkXGqZt7 for <hybi@ietfa.amsl.com>; Wed, 25 May 2011 01:05:06 -0700 (PDT)
Received: from smtp-out.google.com (smtp-out.google.com [216.239.44.51]) by ietfa.amsl.com (Postfix) with ESMTP id 5048AE06D5 for <hybi@ietf.org>; Wed, 25 May 2011 01:05:06 -0700 (PDT)
Received: from wpaz33.hot.corp.google.com (wpaz33.hot.corp.google.com [172.24.198.97]) by smtp-out.google.com with ESMTP id p4P855Sk030958 for <hybi@ietf.org>; Wed, 25 May 2011 01:05:05 -0700
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=google.com; s=beta; t=1306310705; bh=cKSid0i98Q/3xmhblZu/q21WkWE=; h=MIME-Version:In-Reply-To:References:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=wnd/oL85yxi2Kj2KEgt8JYU2kKJvxEoIAwAAw62zNRcRUouk8SwxFF4LSRmkoIoPK +dMBj5Sb6mgbBPKo1aZDg==
Received: from ywg4 (ywg4.prod.google.com [10.192.7.4]) by wpaz33.hot.corp.google.com with ESMTP id p4P84dPZ017278 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=NOT) for <hybi@ietf.org>; Wed, 25 May 2011 01:05:04 -0700
Received: by ywg4 with SMTP id 4so3310053ywg.38 for <hybi@ietf.org>; Wed, 25 May 2011 01:05:04 -0700 (PDT)
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=IQzMwMR0s9b5K1SXmw/keMTyhChojMkjj4d0NX8KDyU=; b=cxp+TWFx1Ww4zGeVX0M5ecgodKFBka12+DcPDm/40WG7Ef579IvB2j4125oYaAVHo1 G8VY4PSy1xPF7qySC+rQ==
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=c+qxfniaZfdyEWjaC3b0Rk9Z7+9S4Ez2wrRrb4oPsAAWrMRhlj8HO155yDx4E+Fghq 6Rl01sxQqDVK6thbIdoQ==
Received: by 10.151.99.6 with SMTP id b6mr4885076ybm.342.1306310704150; Wed, 25 May 2011 01:05:04 -0700 (PDT)
MIME-Version: 1.0
Received: by 10.150.50.13 with HTTP; Wed, 25 May 2011 01:04:44 -0700 (PDT)
In-Reply-To: <4DA6A003.3070308@warmcat.com>
References: <BANLkTimN3LK=nwhnWheVnhw4Ax4KmLWOgA@mail.gmail.com> <4DA6A003.3070308@warmcat.com>
From: Takeshi Yoshino <tyoshino@google.com>
Date: Wed, 25 May 2011 17:04:44 +0900
Message-ID: <BANLkTikuAfXAe_2sbXC+w98vG0txbPv+6w@mail.gmail.com>
To: Andy Green <andy@warmcat.com>
Content-Type: multipart/alternative; boundary="0015175114de7cba0604a41529dd"
X-System-Of-Record: true
Cc: "hybi@ietf.org" <hybi@ietf.org>
Subject: Re: [hybi] Subprotocol semantics. How SHOULD/MUST user-agent and server deal with it
X-BeenThere: hybi@ietf.org
X-Mailman-Version: 2.1.12
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: Wed, 25 May 2011 08:05:07 -0000

On Thu, Apr 14, 2011 at 16:19, Andy Green <andy@warmcat.com> wrote:

> On 04/14/2011 07:57 AM, Somebody in the thread at some point said:
> f) supports multiple subprotocols but Sec-WebSocket-Protocol in request
>
>> didn't contain any of them
>>
>
>  It sounds clear to me that we should drop the request in case f).
>>
>
> Right... whatever the plan was for no explicit protocol being negotiated,
> it no longer makes any sense.
>
> The protocol should always have to be explicitly requested by the client
> even if the server only supports that one, you don't know if a different
> client who assumes it is a different protocol is connecting to you
> otherwise.  There'd be no error and if the protocols were similar the
> failure mode might take a long time to show or be subtle.
>

Thanks, Andy.

As no one seems to be interested in usefulness of these strange cases, I'd
suggest explicitly drop these cases a) - d) in the client requirements
normative section. So the resulting spec texts for Sec-WebSocket-Protocol
handling is like this.

====
Sec-WebSocket-Protocol in request
- 1#(token | quoted-string)
- characters in each of element after unquoting must be in the range U+0021
to U+007E

Sec-WebSocket-Protocol in response
- (token | quoted-string)
-- This forbids case b)
- characters in string after unquoting must be in the range U+0021 to U+007E

User agent must
- (if subprotocols is given) format and send subprotocols
- (otherwise) send nothing

User agent fail when
- sent subprotocols but didn't receive subprotocol  # This forbids case c)
- sent subprotocols and received subprotocol but it's not in sent
subprotocols  # This forbids case a)
- didn't send subprotocols but received subprotocol  # This forbids case d)
- received bad formatted subprotocol
Otherwise, pass received subprotocol to upper layer

Server side fail when
- received bad formatted subprotocols
- whenever the server is not satisfied with subprotocols
-- This relegates decision for e) and f) to server implementation

Server
- (if received subprotocols) must choose one subprotocol from subprotocols,
format and send it
- (otherwise) must not send subprotocol
====