Re: [hybi] Ticket#1 Http Compliance

Greg Wilkins <gregw@webtide.com> Mon, 17 May 2010 09:35 UTC

Return-Path: <gregw@webtide.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 81C383A6966 for <hybi@core3.amsl.com>; Mon, 17 May 2010 02:35:41 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -0.274
X-Spam-Level:
X-Spam-Status: No, score=-0.274 tagged_above=-999 required=5 tests=[AWL=-0.275, BAYES_50=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 AXm1NfD+YH3a for <hybi@core3.amsl.com>; Mon, 17 May 2010 02:35:40 -0700 (PDT)
Received: from mail-ww0-f44.google.com (mail-ww0-f44.google.com [74.125.82.44]) by core3.amsl.com (Postfix) with ESMTP id CF9333A695A for <hybi@ietf.org>; Mon, 17 May 2010 02:35:15 -0700 (PDT)
Received: by wwb28 with SMTP id 28so2252593wwb.31 for <hybi@ietf.org>; Mon, 17 May 2010 02:35:04 -0700 (PDT)
Received: by 10.227.156.9 with SMTP id u9mr4644780wbw.27.1274088903297; Mon, 17 May 2010 02:35:03 -0700 (PDT)
Received: from [192.168.0.100] (host116-234-static.43-88-b.business.telecomitalia.it [88.43.234.116]) by mx.google.com with ESMTPS id l23sm39465247wbb.20.2010.05.17.02.34.57 (version=TLSv1/SSLv3 cipher=RC4-MD5); Mon, 17 May 2010 02:34:57 -0700 (PDT)
Message-ID: <4BF10DBF.2010505@webtide.com>
Date: Mon, 17 May 2010 11:34:55 +0200
From: Greg Wilkins <gregw@webtide.com>
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.9) Gecko/20100423 Thunderbird/3.0.4
MIME-Version: 1.0
To: "hybi@ietf.org" <hybi@ietf.org>
References: <4BEAB021.5030600@webtide.com> <16A430F2-1458-404C-839B-7EEF23434026@apple.com> <4BEBBD7D.8090609@webtide.com> <16DD953D-55E8-4188-B979-0AA348878C73@apple.com> <4BEBCC37.5070808@webtide.com> <3276A7F4-0A3A-4099-8A35-860DD0B93032@apple.com> <4BEBF5E8.2020800@webtide.com> <4BEC2070.5030705@caucho.com>
In-Reply-To: <4BEC2070.5030705@caucho.com>
X-Enigmail-Version: 1.0.1
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 7bit
Subject: Re: [hybi] Ticket#1 Http Compliance
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: Mon, 17 May 2010 09:35:41 -0000

On 13/05/10 17:53, Scott Ferguson wrote:
> Greg Wilkins wrote:
>> In order to claim websocket compliance, I do not want to
>> have to change my server so that every URL that receives
>> a bad websocket upgrade has to close the connection without
>> sending some legal HTTP error response (eg 400 or 404).
>>   
> Agreed. This is a big issue. The server must be allowed to return a
> valid HTTP response rejecting the Upgrade request.


I'd like to expand on this point with examples, to illustrate why
I think compliance is necessary and that websocket clients
are going to end up seeing HTTP responses anyway.


A server that is both a HTTP server and a Websocket server
may use cookies to authenticate users (which is allowed
by current websocket draft).   Frequently such authentication
is implemented by a filter/handler/valve applied in front
of a web application.  Often that filter/handler/valve is
provided by a 3rd party and sometimes imposed by a different
part of an organization.

Without HTTP compliance, if that filter see's an invalid or
missing authentication cookie, then it will have to decide
if it will send a HTTP compliant response (403) or a
Websocket compliant response (close connection).  In all
likelihood, the authenticator will know nothing about
websockets (nor should it) and will send a 403 response.


Similarly, if a developer made a mistake with the URL
and attempted a websocket connection to the wrong resource,
then the request would end up in code that probably knows
nothing about websocket, and will again be faced with the
choice of sending a HTTP compliant response (404) or
a websocket compliant response (close connection).

Alternately, if a deployer made a mistake and deployed
an otherwise correct and capable websocket application
behind something like apache mod_jk, then code that
is fully knowledgeable about websocket would receive
the upgrade request and would want to reject it
(because it knows AJP13 cannot do websocket).   However,
it is not possible for this code to just close
the connection (the connection is on a different machine
and terminated by code that does not know websocket).
So in this case, even code that does know websocket
is only able to send a HTTP compliant response.


So in all these examples, it shows that a combined
HTTP/websocket server is likely to have many situations
where the only possibility for it is to send a HTTP
compliant response.       If a HTTP compliant response
is not websocket compliant, than any problems these
responses cause with 3rd party websocket clients
are likely to be met with
its-your-fault-because-you-are-not-compliant


It is very clear that if a port is to be shared
with HTTP, the websocket clients WILL see
compliant HTTP responses to handshakes.
So clients will need to be written to well handle
such responses, even if in most cases all
non-101 responses are handled as failures.
But a well written client should also be able
to tell it's user the difference between a
2xx, 3xx, 4xx and 5xx etc so they might know
the reason for a failure without the need to
snoop the network.


So if HTTP compliance is required before the
handshake, it is not going to compel clients
to do anything that they would not be doing
anyway.     But it would take away the
dilemma on the server side of should a
HTTP compliant or a websocket compliant
rejection be sent.


regards