[hybi] opening headers: multiplicity / port in host

Tobias Oberstein <tobias.oberstein@tavendo.de> Sat, 29 October 2011 12:27 UTC

Return-Path: <tobias.oberstein@tavendo.de>
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 A5B6D21F8753 for <hybi@ietfa.amsl.com>; Sat, 29 Oct 2011 05:27:43 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.599
X-Spam-Level:
X-Spam-Status: No, score=-2.599 tagged_above=-999 required=5 tests=[AWL=0.000, BAYES_00=-2.599]
Received: from mail.ietf.org ([12.22.58.30]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 7Z7Et76TUmaC for <hybi@ietfa.amsl.com>; Sat, 29 Oct 2011 05:27:43 -0700 (PDT)
Received: from EXHUB020-4.exch020.serverdata.net (exhub020-4.exch020.serverdata.net [206.225.164.31]) by ietfa.amsl.com (Postfix) with ESMTP id 1F2A821F86D0 for <hybi@ietf.org>; Sat, 29 Oct 2011 05:27:42 -0700 (PDT)
Received: from EXVMBX020-12.exch020.serverdata.net ([169.254.3.230]) by EXHUB020-4.exch020.serverdata.net ([206.225.164.31]) with mapi; Sat, 29 Oct 2011 05:27:42 -0700
From: Tobias Oberstein <tobias.oberstein@tavendo.de>
To: "hybi@ietf.org" <hybi@ietf.org>
Date: Sat, 29 Oct 2011 05:27:41 -0700
Thread-Topic: opening headers: multiplicity / port in host
Thread-Index: AcyWNajsoM/4C50qRjabcC/IvLSoRg==
Message-ID: <634914A010D0B943A035D226786325D42D0B0D8372@EXVMBX020-12.exch020.serverdata.net>
Accept-Language: de-DE, en-US
Content-Language: de-DE
X-MS-Has-Attach:
X-MS-TNEF-Correlator:
acceptlanguage: de-DE, en-US
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
Subject: [hybi] opening headers: multiplicity / port in host
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: Sat, 29 Oct 2011 12:27:43 -0000

Polishing up our WS handshake code, I have 3 short questions regarding headers:

1)
The spec is explicit about the allowed header multiplicity in opening handshake requests and responses for the headers:

sec-websocket-key
sec-websocket-accept
sec-websocket-protocol
sec-websocket-extensions
sec-websocket-version

I couldn't find text mentioning multiplicity wrt:

origin (was: sec-websocket-origin)
host
connection
upgrade

Is the following right?

Host header MUST appear exactly once in request (by HTTP spec).

Origin header MUST NOT appear more than once in request (exactly once for browser clients).

Upgrade/Connection: may contain multiple (comma separated) values, may appear more than once (by HTTP spec).


2) Upgrade header multiplicity
 
Hybi-17:
"""
   5.   The request MUST contain an "Upgrade" header field whose value
        is equal to "websocket".

   6.   The request MUST contain a "Connection" header field whose value
        MUST include the "Upgrade" token.
"""

The HTTP spec seems to allow multiple values (and presumably also multiple headers)

Upgrade: HTTP/2.0, SHTTP/1.3, IRC/6.9, RTA/x11

So is it allowed for a WS client to send i.e.

Upgrade: WebSocket, RTA/x11

and the server accepts WS only, sending back

Upgrade: WebSocket

?

Note that the "Connection" header description in the spec has "extra language"
"MUST include the ... token", which seems to allow multiple values in a single
Connection header as well as multiple Connection headers.

Should the Upgrade header be treated the same?


3) Host header port?

Hybi-17:
"""
   4.   The request MUST contain a "Host" header field whose value is
        equal to /host/.
"""

It does not say "equal to /host/[:/port/]".

However, i.e. both Firefox and Chrome will send i.e.

Host: 127.0.0.1:9001

Are both forms allowed?

Host: /host/
Host: /host/:/port/

And if the client uses the 2nd, validate that /port/ is the one the server is listening on?