[AWS] Bug found in the AWS WebSocket implementation

Thomas Løcke thomas.granvej6 at gmail.com
Tue Jul 16 16:54:49 CEST 2013


Hey all,

Lets say I register a websocket interface like this:

AWS.Net.WebSocket.Registry.Register
        (URI     => "/notifications",
         Factory => Notifications.Create'Access);

With that I can connect my clients to server/notifications just fine. It
just works.

But what happens if I try to connect to server/foo instead of
server/notifications?

I would expect to get some sort of error, but insted my client reports a
successful websocket connection, even though the connection obviously isn't
working.

My initial thought was: I've done something wrong. My AWS websocket
implementation is bad. So in order to check that, I turned to the AWS
websocket demo. I compiled it, ran it and observed how it worked as
intended.

Then I opened the file aws/demos/websockets/page.thtml and changed this
line:

ws = AWS.WebSocket.open('ws://' + server + '/echo', 'data', 'status');

to

ws = AWS.WebSocket.open('ws://' + server + '/FOOBAR', 'data', 'status');

and ran the demo again, and lo and behold, this is what the browser
reported after having clicked the "start" button on the webpage:

Your browser supports webSocket.
WebSocket now opened

The first line is arguably correct, since my server does indeed support
websockets, even though it can be argued that the server does not support
websockets on the unknown address of /FOOBAR. The second line is just plain
weird, as there for sure isn't an actual connection, since the demo does
not work at all now. The client most certainly believe that the websocket
connection is fine and dandy, but in reality it isn't.

I've tried connecting using both Javascript and Dart, and the same thing
happens. This has been verified using Firefox and Chrome.

So it seems that the AWS websocket implementation doesn't handle
connections to unknown URI's very well. Instead of giving the client some
sort of sane error, it just silently allows some sort of halfbaked
connection, leaving you with a system that doesn't work, even though the
client believes everything to be in perfect order.

Is there a way to solve this? Have I found a bug? AFAIK this is not how
websockets are supposed to behave. Trying to connect to other
implementations I usually get a plain 404 dumped on me if I try to connect
to unknown addresses.

:o)
Thomas Løcke
-------------- next part --------------
An HTML attachment was scrubbed...
URL: </pipermail/aws/attachments/20130716/ca818d3a/attachment.html>


More information about the AWS mailing list