Re: [hybi] Intermediaries and idle connections (was Re: Technical feedback.)

Maciej Stachowiak <mjs@apple.com> Sun, 31 January 2010 00:23 UTC

Return-Path: <mjs@apple.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 B4C3B3A683F for <hybi@core3.amsl.com>; Sat, 30 Jan 2010 16:23:06 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -106.468
X-Spam-Level:
X-Spam-Status: No, score=-106.468 tagged_above=-999 required=5 tests=[BAYES_00=-2.599, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_MED=-4, SARE_RMML_Stock10=0.13, USER_IN_WHITELIST=-100]
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 AwxE8GYig1gv for <hybi@core3.amsl.com>; Sat, 30 Jan 2010 16:23:05 -0800 (PST)
Received: from mail-out3.apple.com (mail-out3.apple.com [17.254.13.22]) by core3.amsl.com (Postfix) with ESMTP id 367A13A67E1 for <hybi@ietf.org>; Sat, 30 Jan 2010 16:23:05 -0800 (PST)
Received: from relay13.apple.com (relay13.apple.com [17.128.113.29]) by mail-out3.apple.com (Postfix) with ESMTP id 439EC82D0C4E for <hybi@ietf.org>; Sat, 30 Jan 2010 16:23:33 -0800 (PST)
X-AuditID: 1180711d-b7b18ae000001001-5f-4b64cd85e569
Received: from et.apple.com (et.apple.com [17.151.62.12]) by relay13.apple.com (Apple SCV relay) with SMTP id 66.0C.04097.58DC46B4; Sat, 30 Jan 2010 16:23:33 -0800 (PST)
MIME-version: 1.0
Content-type: multipart/alternative; boundary="Boundary_(ID_7M3gMTTcWlMyH4ZOJtYlbQ)"
Received: from [10.0.1.5] (c-69-181-42-237.hsd1.ca.comcast.net [69.181.42.237]) by et.apple.com (Sun Java(tm) System Messaging Server 6.3-7.04 (built Sep 26 2008; 32bit)) with ESMTPSA id <0KX300GV8538AM60@et.apple.com> for hybi@ietf.org; Sat, 30 Jan 2010 16:23:32 -0800 (PST)
From: Maciej Stachowiak <mjs@apple.com>
In-reply-to: <4B64B179.9050502@webtide.com>
Date: Sat, 30 Jan 2010 16:23:31 -0800
Message-id: <2D6C6FEE-2019-44E4-BD82-7BF68B30A518@apple.com>
References: <de17d48e1001280012i2657b587i83cda30f50013e6b@mail.gmail.com> <4B620B8F.6030706@gmx.de> <Pine.LNX.4.64.1001282217320.22053@ps20323.dreamhostps.com> <bbeaa26f1001281449q1a6e1813q3f537fe15a5a9d60@mail.gmail.com> <4B625733.2020907@webtide.com> <6.2.5.6.2.20100128225542.06fa8d68@resistor.net> <Pine.LNX.4.64.1001290817520.22020@ps20323.dreamhostps.com> <4B62C5FE.8090904@it.aoyama.ac.jp> <Pine.LNX.4.64.1001291134350.22020@ps20323.dreamhostps.com> <4B62E516.2010003@webtide.com> <5c902b9e1001290756r3f585204h32cacd6e64fbebaa@mail.gmail.com> <4B636757.3040307@webtide.com> <E379EA13-D58A-4BFB-A62D-2B931A54E276@apple.com> <4B63DD6B.5030803@webtide.com> <E765982E-06B5-48BC-B75D-02E3F9555018@apple.com> <4B64B179.9050502@webtide.com>
To: Greg Wilkins <gregw@webtide.com>
X-Mailer: Apple Mail (2.1077)
X-Brightmail-Tracker: AAAAAQAAAZE=
Cc: Hybi <hybi@ietf.org>
Subject: Re: [hybi] Intermediaries and idle connections (was Re: Technical feedback.)
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: Sun, 31 Jan 2010 00:23:06 -0000

On Jan 30, 2010, at 2:23 PM, Greg Wilkins wrote:

> Maciej Stachowiak wrote:
> 
>>> But for starters... let's make the upgrade request not just look like a HTTP request, let's make it a real HTTP request.  Then intermediaries and servers would be free to add
>>> new headers and do funky HTTP stuff without needing to involve the browsers.
>> 
>> I don't have anything against this suggestion per se, but it doesn't seem to solve either of the problems raised above:
> 
> It doesn't solve the problems, but it enables more standard solutions to them.
> It also does not break intermediaries and servers just for giggles.

I don't know whether the hardcoded handshake format it the right tradeoff overall. But reasons have been given for it, so I don't think its fair to call it "just for giggles". If you can explain how making the HTTP upgrade handshake more flexible would help solve specific problems, then it would be easier to do a cost-benefit analysis.

>> 
>> It seems like we need a mechanism for that which is robust in the face of unaware intermediaries. One way I can think of to do that is to encode the information in a hop-by-hop header. [...]

> I think a hop-by-hop header is exactly what is needed, so that any non transparent
> proxy would have to explicitly copy the timeout value from input to output.

Copy or adjust, if its idle timeout is lower than the last server it talked to.

> 
> This would still be an issue for transparent proxies that try to not look like
> a hope, but at least the argument could be made that the timeout value is there
> in the header so they should at least respect it.

Sounds like the hop-by-hop header design is broken in the face of transparent proxies, if they do indeed preserve hop-by-hop headers. Is that truly the case for deployed transparent proxies? How common are they? (The reason I say it breaks the feature is because you'd have no way of detecting whether you are going through an unaware transparent proxy, so you can't tell either whether your path is really clean, or whether the idle timeout you got is accurate.)

It also seems like the hop-by-hop header technique does not work for WebSocket over SSL. That's a pretty serious problem, because I think that's the only case that is likely to work over most unmodified proxies. Any idea how to address the SSL case?

> 
> So this header will not initially solve the problem, because of non compliant
> intermediaries.   However, together with orderly close, it would allow non compliant
> intermediaries to be detected (and new connections with shorter idle timeout
> re-established).

There's really two problems to be solved:
(a) Detect that your path to the origin server, including all intermediaries, consists solely of WebSocket-aware servers.
(b) Determine some information about the max idle timeout, which is valid if based on (a) you detected that you have a fully aware path.

I don't see how a close handshake would allow unaware intermediaries to be detected. The handshake would presumably be done by the origin server and would not even take the form of an http message. If WebSocket can go through the intermediary at all, then the handshake is likely to go through unmodified. Are you saying that if you don't see the handshake you should assume an intermediary timed you out? That seems like a poor assumption, because any number of network failures could have interrupted a connection. Also, how long do you assume that your path to the client or origin server is going through the same proxis?

> 
> 
>>> Ideally there could be some non 101 return codes that could be sent so that a websocket client and a websocket server could have several rounds of negotiation for things like
>>> credentials, timeouts and maybe even redirections!
>> 
>> That might help with the origin server, but does it help with intermediaries? If intermediaries would normally just pass through a 101, then you cannot tell if an intermediary
>> would time you out faster than your origin server.
> 
> Intermediaries often respond to a request on a servers behalf.  They may need
> their own authentication or they may do a redirect themselves.
> 
> So in a chain A-B-C,  perhaps A-B will first negotiate in a few exchanges
> and then A-C will negotiate before the connection is established.
> 
> So websocket needs to define what happens when a upgrade request is
> responded to with a 401, 302 etc.

I don't entirely understand how your proposal would work. But the issue I'm raising is that if the origin server or an intermediary responds with a 101, that doesn't tell you if there were any unaware intermediaries in the path between you and them. So it does not solve the problem of knowing you have buy-in from intermediaries, or computing your idle time-out.

Regards,
Maciej