Re: [hybi] Are HTTP bodies allowed in Websocket client handshakes?

Philipp Serafin <phil127@gmail.com> Wed, 01 November 2023 08:16 UTC

Return-Path: <phil127@gmail.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 1AA29C15107E for <hybi@ietfa.amsl.com>; Wed, 1 Nov 2023 01:16:53 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.854
X-Spam-Level:
X-Spam-Status: No, score=-1.854 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, RCVD_IN_ZEN_BLOCKED_OPENDNS=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01, URIBL_BLOCKED=0.001, URIBL_DBL_BLOCKED_OPENDNS=0.001, URIBL_ZEN_BLOCKED_OPENDNS=0.001] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com
Received: from mail.ietf.org ([50.223.129.194]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id BaYsAvG7HBnP for <hybi@ietfa.amsl.com>; Wed, 1 Nov 2023 01:16:52 -0700 (PDT)
Received: from mail-qt1-x82b.google.com (mail-qt1-x82b.google.com [IPv6:2607:f8b0:4864:20::82b]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 62B83C14CE36 for <hybi@ietf.org>; Wed, 1 Nov 2023 01:16:52 -0700 (PDT)
Received: by mail-qt1-x82b.google.com with SMTP id d75a77b69052e-41e1921da84so40840351cf.1 for <hybi@ietf.org>; Wed, 01 Nov 2023 01:16:52 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1698826611; x=1699431411; darn=ietf.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=Z2bQHVTjNNGiYc75wJQwirWKNpKA0IE/dC2xAMZjcZU=; b=UJEZE+SLZquiBYQLeC24jx/K0oHras9p0OotGFKXneZxGR8SF4wYkd1YHeCDSlj+Eu nxxd/J53BU2dJGOR6KFVKxI75vY0M/cdFBo3RcA/4jUS0JUXR02RkEJFYwAY68GE9Hiu hyipGSMNjGlw+402bd4A7INjABEWq6nrRvdDaWQPWAJcAfVrQ+597eYMB8rcRZ4LeFm9 lBjtBfnjjGNJF+MBEr1EoJmaCH0PSy6L98OMUtL1/POcoMaEIvLMqwPaBcAc9IXMy3aS xqaVuBnU44r4TptM2BACNymT8K5/BIZCG2EDCMKCIXw2uCKShA85jQ4+a1T+B37fg4bK BB7A==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698826611; x=1699431411; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=Z2bQHVTjNNGiYc75wJQwirWKNpKA0IE/dC2xAMZjcZU=; b=Wa8XQATLLBBuAnQ1TFqvZOVpFPd1soCrQtgOjGox4K+Yh1EmFSwD+b6yhe59wkyjoP UcTMwwuSFb06NdmASewfDefFR9vZ2WIWbx9nnHnzq+4zfDyo0unIb2FwMjEdlsv7WV2U 0DwnJH0TKhuvsbtgNaDA7LwzXsdQLHnNVWu3qd9R8Zs8t+ev5JvqGx/KYA1VB7WkQPfN VvgRLrsA0KzcliMSeYWQcRHLjDOBKSAAedo6F4Af/ShzT2XMpF8eXDwMc1AHs/DKg8L4 uECfeKuj3rvc9fuEROWIDZQpiZB5YITPqrDYuLg8XqpXaIRmZ1zQU+j8shd7QqEjIoEP kDBQ==
X-Gm-Message-State: AOJu0YwwiDxPq9NqhHNqmd6kDLh82j3Fd4Zaepl4MnZBeXWE3NGQifoD 8F1DC28aH2LKPtpGVqYcBYbI6Sd4s2Vfc5s/iZE=
X-Google-Smtp-Source: AGHT+IHrpUZKJ+mC+yNZfr/EJLZn5yXOdRwGyl37qNeQOe8caNfpH5THd4udRzBenykmxiVdtmUAHJ/sCUI5i8jyMBI=
X-Received: by 2002:a05:622a:54d:b0:41c:bbd0:48c2 with SMTP id m13-20020a05622a054d00b0041cbbd048c2mr16881431qtx.59.1698826610869; Wed, 01 Nov 2023 01:16:50 -0700 (PDT)
MIME-Version: 1.0
References: <CAM70yxBLYpf9uG=z2eAmQhRQgPvzvMWDC+vBPYEnq=Cqw7+9Bg@mail.gmail.com> <c7c1bc46-4eff-4087-954d-c478de999a3b@warmcat.com>
In-Reply-To: <c7c1bc46-4eff-4087-954d-c478de999a3b@warmcat.com>
From: Philipp Serafin <phil127@gmail.com>
Date: Wed, 01 Nov 2023 09:16:39 +0100
Message-ID: <CAMaigV=L2bii6Dr8qT8VRm7haQDc+sD-KZNrBMb0PYYYhX3zkQ@mail.gmail.com>
To: Andy Green <andy@warmcat.com>
Cc: Emile Cormier <emile.cormier.jr@gmail.com>, Hybi <hybi@ietf.org>
Content-Type: multipart/alternative; boundary="000000000000ad0941060912e4ba"
Archived-At: <https://mailarchive.ietf.org/arch/msg/hybi/UP-joByFw9AcHdn0U9NmyAveckk>
Subject: Re: [hybi] Are HTTP bodies allowed in Websocket client handshakes?
X-BeenThere: hybi@ietf.org
X-Mailman-Version: 2.1.39
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: <https://mailarchive.ietf.org/arch/browse/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, 01 Nov 2023 08:16:53 -0000

Isn't the upgrade request still technically a  GET request? If so I'd say
this already prohibits the client from sending any body.

Andy Green <andy@warmcat.com> schrieb am Mi., 1. Nov. 2023, 08:26:

>
>
> On 10/31/23 22:22, Emile Cormier wrote:
> > Hi,
> >
> > As per the subject, are HTTP bodies allowed in Websocket client
> > handshakes? Should the server ignore them, or treat their presence as a
> > protocol error? Web searches don't bring up anything about this question.
>
> At the time of the UPGRADE request, the connection is purely http still,
> so whatever you can send with UPGRADE and how to send it there is
> defined outside of ws.
>
> https://datatracker.ietf.org/doc/html/rfc9110#name-upgrade
>
> doesn't seem to talk about if you can send a body either, however it
> does say
>
>    A client cannot begin using an upgraded protocol on the connection
>    until it has completely sent the request message (i.e., the client
>    can't change the protocol it is sending in the middle of a message).
>
> "completely sent the request message" sounds like it would include any
> pointless body that went out with the request message IIUI, implying the
> server should swallow the body before replying.  IOW "UPGRADE request"
> includes any redundant body sent with it.
>
> In the case that the upgrade succeeds, data after the "UPGRADE request"
> will switch to ws protocol.  The server will interpret any data after
> the "UPGRADE request" as ws protocol data.
>
>   - UPGRADE req no body -> server doesn't consume body -> OK
>   - UPGRADE req no body -> server consumes body -> OK
>   - UPGRADE req + body -> server doesn't consume body -> broken conn
>   - UPGRADE req no body -> server consumes body -> OK
>
> In the case the upgrade is denied, the connection remains in http.
> There shouldn't be any leftover unconsumed body from the earlier failed
> UPGRADE request to pipeline into as the next transaction, so again it
> seems the server should eat any body with the upgrade request before
> replying.
>
> At least, that's my understanding.
>
> > The RFC only uses the term "body" in relation to close, ping, and pong
> > frames
> -Andy
>
> > Cheers,
> > Emile Cormier
> >
> > _______________________________________________
> > hybi mailing list
> > hybi@ietf.org
> > https://www.ietf.org/mailman/listinfo/hybi
>
> _______________________________________________
> hybi mailing list
> hybi@ietf.org
> https://www.ietf.org/mailman/listinfo/hybi
>