Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jetty-users] Jetty and Http 1.1 upgrade header

Hi,

On Mon, Sep 24, 2012 at 10:58 PM, Bergmann Manfred <manfred@xxxxxxxxxxx> wrote:
> Hi there.
>
> We use Jetty 8.1.5 in our current development.
> Does anyone know whether Jetty supports the Http 1.1 upgrade header to upgrade from an unencrypted connection to an encrypted connection?
> See http://en.wikipedia.org/wiki/HTTP/1.1_Upgrade_header

It is not supported directly, but the mechanisms to make it work are
there, since are those used by WebSocket.

The upgrade to SSL never got much traction due to the fact that port
443 is allocated for https, so almost everybody implements the
"upgrade" with a redirect to 443.
Feels awkward to have encrypted HTTP on port 80, but I digress.

Look at WebSocketServlet.service() that calls
WebSocketFactory.acceptWebSocket() that calls
WebSocketFactory.upgrade() and the magic is at the last line, where
you set a special request attribute that tells Jetty to switch the
connection: request.setAttribute("org.eclipse.jetty.io.Connection",
connection);

We may have something more formal in Jetty 9.

Simon
-- 
http://cometd.org
http://webtide.com
Developer advice, services and support
from the Jetty & CometD experts.
----
Finally, no matter how good the architecture and design are,
to deliver bug-free software with optimal performance and reliability,
the implementation technique must be flawless.   Victoria Livschitz


Back to the top