Re: [hybi] Ticket#1 Http Compliance

Greg Wilkins <gregw@webtide.com> Mon, 17 May 2010 09:40 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 9DDFF3A6988 for <hybi@core3.amsl.com>; Mon, 17 May 2010 02:40:00 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -0.27
X-Spam-Level:
X-Spam-Status: No, score=-0.27 tagged_above=-999 required=5 tests=[AWL=-0.271, 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 F61mgMgW7ui2 for <hybi@core3.amsl.com>; Mon, 17 May 2010 02:39:59 -0700 (PDT)
Received: from mail-wy0-f172.google.com (mail-wy0-f172.google.com [74.125.82.172]) by core3.amsl.com (Postfix) with ESMTP id DC6863A692B for <hybi@ietf.org>; Mon, 17 May 2010 02:39:44 -0700 (PDT)
Received: by wyb42 with SMTP id 42so2425978wyb.31 for <hybi@ietf.org>; Mon, 17 May 2010 02:39:32 -0700 (PDT)
Received: by 10.227.134.84 with SMTP id i20mr4598856wbt.52.1274089172167; Mon, 17 May 2010 02:39:32 -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 z33sm39501945wbd.19.2010.05.17.02.39.31 (version=TLSv1/SSLv3 cipher=RC4-MD5); Mon, 17 May 2010 02:39:31 -0700 (PDT)
Message-ID: <4BF10ED0.2010305@webtide.com>
Date: Mon, 17 May 2010 11:39:28 +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:40:00 -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 server&application
behind something like apache mod_jk, then code that
is fully aware of websocket would receive the upgrade
request and should reject it because it AJP13 cannot do
websocket.   However, it is not possible for this code
to just close the connection which 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 is for it 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 websocket compliant".


It is very clear that if a port is to be shared
with HTTP, then websocket clients WILL see
compliant HTTP responses to handshakes.
Clients will need to be written to well handle
such responses, even if in most cases all
non-101 responses are treated 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.

It would also facilitate the possible real
use of other HTTP features and minimal
RTT connection negotiation.

regards