Re: [hybi] WebSocket protocol as it stands

Ryan Worsley <ryanthemadone@gmail.com> Sat, 06 November 2010 15:44 UTC

Return-Path: <ryanthemadone@gmail.com>
X-Original-To: hybi@core3.amsl.com
Delivered-To: hybi@core3.amsl.com
Received: from localhost (localhost [127.0.0.1]) by core3.amsl.com (Postfix) with ESMTP id A6AF93A67ED for <hybi@core3.amsl.com>; Sat, 6 Nov 2010 08:44:02 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.598
X-Spam-Level:
X-Spam-Status: No, score=-2.598 tagged_above=-999 required=5 tests=[BAYES_00=-2.599, HTML_MESSAGE=0.001]
Received: from mail.ietf.org ([64.170.98.32]) by localhost (core3.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id P2b-JCP4ylTU for <hybi@core3.amsl.com>; Sat, 6 Nov 2010 08:44:00 -0700 (PDT)
Received: from mail-qy0-f179.google.com (mail-qy0-f179.google.com [209.85.216.179]) by core3.amsl.com (Postfix) with ESMTP id 813133A67E3 for <hybi@ietf.org>; Sat, 6 Nov 2010 08:43:59 -0700 (PDT)
Received: by qyk33 with SMTP id 33so439545qyk.10 for <hybi@ietf.org>; Sat, 06 Nov 2010 08:44:15 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:in-reply-to :references:date:message-id:subject:from:to:cc:content-type; bh=8zriCrG3Pfy+8Fb47GbTWSjZPIKZEX79GAexHPCu5fs=; b=BUGastiGuGtKKExX5IyKOJp5L9Zlunsa+JgejPipBWy0+HOoGW171d6DBC9ajmSnx4 yGvRC33k3Y0PVeJCYWxj2OcLL3YXNZjU2a680fXJ7bT1FrIRlQi/esivnG8ym4ufxltm 9FjACmZfqJZh7WJ5gl/UjJzpRHA5P44l0DyLw=
DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; b=xcX4SWaFetQx9kiS8pLL73lBdd9U4DsQW9XVPMC6/gZEblJZBTOetlneTAVRwDLwgL rl8XjxWgfLXLmYQ5OGatE7OkkTbbmhQWs0uStc5C24hjbuiVFbNdkzCG8VIfKA9Iflqk q3gErckA0DrLQF7iZe+HLq2cevgfKq9zDv4qk=
MIME-Version: 1.0
Received: by 10.224.190.197 with SMTP id dj5mr2029791qab.129.1289058249591; Sat, 06 Nov 2010 08:44:09 -0700 (PDT)
Received: by 10.229.52.70 with HTTP; Sat, 6 Nov 2010 08:44:09 -0700 (PDT)
In-Reply-To: <20101030160830.GB793@1wt.eu>
References: <AANLkTinHzGPw4cJ2Qkr26WDnjKRUhFpWdM3pNqECPmoC@mail.gmail.com> <20101030061753.GA793@1wt.eu> <AANLkTin1Mm3KxgTbdLUWg+TCguH6hwREt9ZFOE099=dg@mail.gmail.com> <20101030160830.GB793@1wt.eu>
Date: Sat, 06 Nov 2010 15:44:09 +0000
Message-ID: <AANLkTimFUqbpHzDFLuNfqK4xg-K5xnyKQ+zd_37w-Wjj@mail.gmail.com>
From: Ryan Worsley <ryanthemadone@gmail.com>
To: Willy Tarreau <w@1wt.eu>
Content-Type: multipart/alternative; boundary="20cf300fb2a10fecf00494644382"
X-Mailman-Approved-At: Sat, 06 Nov 2010 10:16:35 -0700
Cc: hybi@ietf.org
Subject: Re: [hybi] WebSocket protocol as it stands
X-BeenThere: hybi@ietf.org
X-Mailman-Version: 2.1.9
Precedence: list
List-Id: Server-Initiated HTTP <hybi.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/listinfo/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, 06 Nov 2010 15:44:02 -0000

Hi Willy et al,

I've been doing a lot of digging to get to the bottom of this behaviour in
asp.net.  I've had some excellent conversations with the guys at Microsoft
after Scott Guthrie hooked me up with the people in the know.  I'll copy
Stefan Shackow's response below as I believe he explains the problem
excellently;

*The current technical issue for our stack is that the low-level Windows
HTTP driver that handles incoming HTTP request (http.sys) does not recognize
the current websockets format as having a valid entity body.  As you have
noted, the lack of a content length header means that http.sys does not make
the nonce bytes in the entity available to any upstack callers.  That's part
of the work we will need to do to build websockets support into http.sys.
 Basically we need to tweak http.sys to recognize what is really a non-HTTP
request, as an HTTP request.

Implementation-wise this boils down to how strictly a server-side HTTP
listener interprets incoming requests as HTTP.  For example a server stack
that instead treats port 80 as a TCP/IP socket as opposed to an HTTP
endpoint can readily do whatever it wants with the websockets initiation
request.  We have some client samples, and sample websockets endpoint that
the WCF team is working on that use this approach (details here:
http://tomasz.janczuk.org/2010/07/silverlight-html5-websocket-client-with.html).
 However that work is in flux right now, and I don't what the timelines are
for releasing any prototypes on codeplex.com.

For our server-side HTTP stack we do plan to make the necessary changes to
support websockets since we want IIS and ASP.NET <http://asp.net/> to handle
websockets workloads in the future.  We have folks keeping an eye on the
websockets spec as it progresses and we do plan to make whatever changes are
necessary in the future.*
*
*
---

I personally hope that the next WebSocket draft doesn't require this
somewhat awkward behaviour as it'll necessitate a rewrite of the http stack
in asp.net, which means those of us working with those technologies could be
left out in the cold for a time.

Thanks for all your help, I hope this summary is of use to someone.

Regards,

Ryan Worsley.



On 30 October 2010 17:08, Willy Tarreau <w@1wt.eu> wrote:

> Hi Ryan,
>
> On Sat, Oct 30, 2010 at 04:39:44PM +0100, Ryan Worsley wrote:
> > Hi Willy,
> >
> > Thanks for your considered reply, I actually confirmed this behaviour by
> > using a Microsoft application called wfetch.  if I insert a
> content-length
> > header into the message the body gets through just fine.
>
> I'm not surprized.
>
> > I understand your approach to be to send the response headers immediately
> > and then attempting to read the message body as we're now in a different
> > mode.
>
> It's not a body, it's the beginning of the tunnelled data. The difference
> is precisely that if it were a body, it would be covered by a
> content-length.
> When I first reported this issue a few months ago, I was told that we don't
> want to put a content-length because the goal was precisely to ensure that
> only completely compliant intermediaries would let this pass through.
>
> > Unfortunately this didn't work in IIS and I think I can explain why.
> >
> > At the point at which my application runs, the incoming http message has
> > been processed and packaged into a data structure that is handed to it.
>  No
> > further processing can be done at this point on the inbound message.  I
> can
> > listen on the incoming stream for further data from the client, but the
> body
> > has already been sent and disregarded.
>
> But if you use this data as the incoming stream, are you able to read it ?
> I certainly agree that you can't get it as a body since it's not advertised
> as such.
>
> > It might be possible in my case to hook in at a much lower level of the
> > request processing pipeline.  I'm not sure, so I've posted a request for
> > information on the IIS community forums.
> >
> > Is there any chance that you'll include content-length in the next draft?
>
> Apparently no due to the explanation above. Also, it's possible that a
> next draft will rely again on a completely different handshake.
>
> > What is the ETA of your next draft?
>
> I have no idea.
>
> > Does this aforementioned behaviour make IIS compliant or non compliant?
>
> If IIS does not pass you those 8 bytes as a body, then it's right not to
> do so. However, once you respond the 101 and the headers, it should let
> the data flow between both sides, resulting in the pending 8 bytes to
> reach your application. If you can't get those bytes, it would be nice
> to find out why.
>
> Regards,
> Willy
>
>