RabbitMQ's WebSocket broken

classic Classic list List threaded Threaded
10 messages Options
Reply | Threaded
Open this post in threaded view
|

RabbitMQ's WebSocket broken

Petri Luojus
Hello,

We're using RabbitMQ in our messaging with several AMQP and STOMP over WebSocket clients. STOMP clients are using JavaScript and stomp.js (http://jmesnil.net/stomp-websocket/doc/) in browsers. However, recent stable release for Chrome fixed the following issue: http://code.google.com/p/chromium/issues/detail?id=259666. This in turn broke all Chromium-based clients, and since the WebSocket specification (http://dev.w3.org/html5/websockets/) reports "The connection will only be established if the server reports that it has selected one of these subprotocols." it is expected that this fix will be pushed to other browsers too.

Following messages are changed between client and RabbitMQ, after which Chrome reports "Error during WebSocket handshake: Sec-WebSocket-Protocol mismatch". As can be seen from the response, RabbitMQ does not confirm the selected protocol.

GET /stomp/websocket HTTP/1.1
Upgrade: websocket
Connection: Upgrade
Host: xxx.yyy:15674
Origin: null
Sec-WebSocket-Protocol: v10.stomp, v11.stomp
Pragma: no-cache
Cache-Control: no-cache
Sec-WebSocket-Key: YRpCwsRP6s2ounZHK4soEQ==
Sec-WebSocket-Version: 13
Sec-WebSocket-Extensions: x-webkit-deflate-frame
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/30.0.1599.69 Safari/537.36
Cookie: auth=bHVvanVzOk15aGthbGU1; m=1933:600%7C5|2377:large|2491:chart|2663:t|6967:t|34e2:|4e99:t|2c69:t|2a03:t|745a:t|77cb:t|5cf4:t|3a95:avg|54b5:small|29b3:60%7C5|3a8e:chart|54ae:small|29ac:600%7C5|47ba:t|e69:chart|45b9:600%7C5|4a01:t|ca3:t|79d4:chart|640c:small|678e:60%7C5|4e71:large|4d66:500|1d98:t|6cfc:t|15cc:t

HTTP/1.1 101 Switching Protocols
Upgrade: websocket
Sec-Websocket-Accept: DGeZKxS98lD43p+4Gkhb17W29E0=
Connection: Upgrade

RabbitMQ is installed on CentOS 6.4 with the following versions for the server and Erlang
rabbitmq-server.noarch 3.1.5-1.el6 @epel
erlang.x86_64 R14B-04.2.el6 @epel

Could you guys look into this issue?

Br,
Petri

_______________________________________________
rabbitmq-discuss mailing list
[hidden email]
https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss
Reply | Threaded
Open this post in threaded view
|

Re: RabbitMQ's WebSocket broken

Michael Klishin

On Oct 11, 2013, at 10:58 AM, Petri Luojus <[hidden email]> wrote:

> Could you guys look into this issue?

Petri,

Will adjusting Rabbit to the way new Chrome versions work somehow affect
older browsers? (I'm not a WebSockets expert, as you can tell).

MK



_______________________________________________
rabbitmq-discuss mailing list
[hidden email]
https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss
Reply | Threaded
Open this post in threaded view
|

Re: RabbitMQ's WebSocket broken

Petri Luojus
https://chromiumcodereview.appspot.com/22375002/diff/9001/Source/modules/websockets/WebSocketHandshake.cpp line 540->

By looking at the diff for the change, at least Chrome should accept the connections when the protocol header is present. If I interpret the code correctly, the change was made to a check to the situation where protocol header is set on the request, but the response did not have Web-Socket-Protocol header present.

Current source code for the module (https://chromium.googlesource.com/chromium/blink/+/master/Source/modules/websockets/WebSocketHandshake.cpp) indicates that the connections are accepted when the header is present and it accompanies the same protocol version, which was requested.

So I think, this should not present problems with older Chromium-based browsers. I don't know about Opera/Firefox/Safari/x, but I hope they have implemented the protocol selection procedure as defined by the specification.



On Fri, Oct 11, 2013 at 11:22 AM, Michael Klishin <[hidden email]> wrote:

On Oct 11, 2013, at 10:58 AM, Petri Luojus <[hidden email]> wrote:

> Could you guys look into this issue?

Petri,

Will adjusting Rabbit to the way new Chrome versions work somehow affect
older browsers? (I'm not a WebSockets expert, as you can tell).

MK






--
Petri Luojus
+358 41 437 3592
Oulu, Finland
[hidden email]


_______________________________________________
rabbitmq-discuss mailing list
[hidden email]
https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss
Reply | Threaded
Open this post in threaded view
|

Re: RabbitMQ's WebSocket broken

Emile Joubert
In reply to this post by Petri Luojus

Hi,

On 11/10/13 07:58, Petri Luojus wrote:

> Sec-WebSocket-Protocol: v10.stomp, v11.stomp


Thanks for reporting this issue. It looks like the webserver
infrastructure will need to be upgraded in order to support this. I have
filed a bug to bring this up-to-date.


-Emile



_______________________________________________
rabbitmq-discuss mailing list
[hidden email]
https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss
Reply | Threaded
Open this post in threaded view
|

Re: RabbitMQ's WebSocket broken

Emile Joubert
In reply to this post by Petri Luojus

Hi,

On 11/10/13 07:58, Petri Luojus wrote:

> GET /stomp/websocket HTTP/1.1
> Upgrade: websocket
> Connection: Upgrade
> Host: xxx.yyy:15674
> Origin: null
> Sec-WebSocket-Protocol: v10.stomp, v11.stomp
> Pragma: no-cache
> Cache-Control: no-cache
> Sec-WebSocket-Key: YRpCwsRP6s2ounZHK4soEQ==
> Sec-WebSocket-Version: 13
> Sec-WebSocket-Extensions: x-webkit-deflate-frame
> User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36
> (KHTML, like Gecko) Chrome/30.0.1599.69 Safari/537.36
> Cookie: auth=bHVvanVzOk15aGthbGU1;
> m=1933:600%7C5|2377:large|2491:chart|2663:t|6967:t|34e2:|4e99:t|2c69:t|2a03:t|745a:t|77cb:t|5cf4:t|3a95:avg|54b5:small|29b3:60%7C5|3a8e:chart|54ae:small|29ac:600%7C5|47ba:t|e69:chart|45b9:600%7C5|4a01:t|ca3:t|79d4:chart|640c:small|678e:60%7C5|4e71:large|4d66:500|1d98:t|6cfc:t|15cc:t
>
> HTTP/1.1 101 Switching Protocols
> Upgrade: websocket
> Sec-Websocket-Accept: DGeZKxS98lD43p+4Gkhb17W29E0=
> Connection: Upgrade

Can you confirm what the code you used to generate these headers, and
which revision of stomp.js? I get slightly different headers and no
error when I use the latest version of Chrome and the web stomp examples
that ship in

  http://hg.rabbitmq.com/rabbitmq-web-stomp-examples/


GET ws://localhost:15674/stomp/584/zw7on1yc/websocket HTTP/1.1
Pragma: no-cache
Origin: http://localhost:15670
Host: localhost:15674
Sec-WebSocket-Key: VE4morwMfRKFtxmcVUdddQ==
User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML,
like Gecko) Chrome/30.0.1599.101 Safari/537.36
Upgrade: websocket
Sec-WebSocket-Extensions: x-webkit-deflate-frame
Cache-Control: no-cache
Connection: Upgrade
Sec-WebSocket-Version: 13

HTTP/1.1 101 Switching Protocols
Connection: Upgrade
Sec-Websocket-Accept: x4EO4xRPJ3Cc9kzEnvlv2ToCSvc=
Upgrade: websocket





-Emile




_______________________________________________
rabbitmq-discuss mailing list
[hidden email]
https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss
Reply | Threaded
Open this post in threaded view
|

Re: RabbitMQ's WebSocket broken

Petri Luojus
Hi,

I'm using the following code. Note, that I'm not using SockJS.

var client = Stomp.client('ws://vm0077.virtues.fi:15674/stomp/websocket');
client.heartbeat.outgoing = 20000;
client.heartbeat.incoming = 0;

client.debug = function(str) {
$("#debug").append(str + "\n");
};

var on_connect = function() {
subId = client.subscribe('/exchange/capacity/nothing.special', handleMessage);
console.log('connected');
var data = "Hello World!";
client.send('/exchange/capacity/nothing.special', {}, data);
};

var handleMessage = function(d) {
$("#messages").append(d.body + "\n");
};

var on_error =  function(error) {
console.log(error);
};

client.connect('user', 'pass', on_connect, on_error, '/');

Br,
Petri

Petri Luojus
+358 41 437 3592
Oulu, Finland
[hidden email]



On Fri, Oct 18, 2013 at 1:43 PM, Emile Joubert <[hidden email]> wrote:

Hi,

On 11/10/13 07:58, Petri Luojus wrote:

> GET /stomp/websocket HTTP/1.1
> Upgrade: websocket
> Connection: Upgrade
> Host: xxx.yyy:15674
> Origin: null
> Sec-WebSocket-Protocol: v10.stomp, v11.stomp
> Pragma: no-cache
> Cache-Control: no-cache
> Sec-WebSocket-Key: YRpCwsRP6s2ounZHK4soEQ==
> Sec-WebSocket-Version: 13
> Sec-WebSocket-Extensions: x-webkit-deflate-frame
> User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36
> (KHTML, like Gecko) Chrome/30.0.1599.69 Safari/537.36
> Cookie: auth=bHVvanVzOk15aGthbGU1;
> m=1933:600%7C5|2377:large|2491:chart|2663:t|6967:t|34e2:|4e99:t|2c69:t|2a03:t|745a:t|77cb:t|5cf4:t|3a95:avg|54b5:small|29b3:60%7C5|3a8e:chart|54ae:small|29ac:600%7C5|47ba:t|e69:chart|45b9:600%7C5|4a01:t|ca3:t|79d4:chart|640c:small|678e:60%7C5|4e71:large|4d66:500|1d98:t|6cfc:t|15cc:t
>
> HTTP/1.1 101 Switching Protocols
> Upgrade: websocket
> Sec-Websocket-Accept: DGeZKxS98lD43p+4Gkhb17W29E0=
> Connection: Upgrade

Can you confirm what the code you used to generate these headers, and
which revision of stomp.js? I get slightly different headers and no
error when I use the latest version of Chrome and the web stomp examples
that ship in

  http://hg.rabbitmq.com/rabbitmq-web-stomp-examples/


GET ws://localhost:15674/stomp/584/zw7on1yc/websocket HTTP/1.1
Pragma: no-cache
Origin: http://localhost:15670
Host: localhost:15674
Sec-WebSocket-Key: VE4morwMfRKFtxmcVUdddQ==
User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML,
like Gecko) Chrome/30.0.1599.101 Safari/537.36
Upgrade: websocket
Sec-WebSocket-Extensions: x-webkit-deflate-frame
Cache-Control: no-cache
Connection: Upgrade
Sec-WebSocket-Version: 13

HTTP/1.1 101 Switching Protocols
Connection: Upgrade
Sec-Websocket-Accept: x4EO4xRPJ3Cc9kzEnvlv2ToCSvc=
Upgrade: websocket





-Emile






_______________________________________________
rabbitmq-discuss mailing list
[hidden email]
https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss
Reply | Threaded
Open this post in threaded view
|

Re: RabbitMQ's WebSocket broken

Julian Lyndon-Smith-2
In reply to this post by Petri Luojus
Hey,

did you ever get a solution to this problem ? I've got the same and it's driving me nuts :(

thanks

Julian

On Friday, 11 October 2013 07:58:11 UTC+1, Petri Luojus wrote:
Hello,

We're using RabbitMQ in our messaging with several AMQP and STOMP over WebSocket clients. STOMP clients are using JavaScript and stomp.js (http://jmesnil.net/stomp-websocket/doc/) in browsers. However, recent stable release for Chrome fixed the following issue: http://code.google.com/p/chromium/issues/detail?id=259666. This in turn broke all Chromium-based clients, and since the WebSocket specification (http://dev.w3.org/html5/websockets/) reports "The connection will only be established if the server reports that it has selected one of these subprotocols." it is expected that this fix will be pushed to other browsers too.

Following messages are changed between client and RabbitMQ, after which Chrome reports "Error during WebSocket handshake: Sec-WebSocket-Protocol mismatch". As can be seen from the response, RabbitMQ does not confirm the selected protocol.

GET /stomp/websocket HTTP/1.1
Upgrade: websocket
Connection: Upgrade
Host: xxx.yyy:15674
Origin: null
Sec-WebSocket-Protocol: v10.stomp, v11.stomp
Pragma: no-cache
Cache-Control: no-cache
Sec-WebSocket-Key: YRpCwsRP6s2ounZHK4soEQ==
Sec-WebSocket-Version: 13
Sec-WebSocket-Extensions: x-webkit-deflate-frame
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/30.0.1599.69 Safari/537.36
Cookie: auth=bHVvanVzOk15aGthbGU1; m=1933:600%7C5|2377:large|2491:chart|2663:t|6967:t|34e2:|4e99:t|2c69:t|2a03:t|745a:t|77cb:t|5cf4:t|3a95:avg|54b5:small|29b3:60%7C5|3a8e:chart|54ae:small|29ac:600%7C5|47ba:t|e69:chart|45b9:600%7C5|4a01:t|ca3:t|79d4:chart|640c:small|678e:60%7C5|4e71:large|4d66:500|1d98:t|6cfc:t|15cc:t

HTTP/1.1 101 Switching Protocols
Upgrade: websocket
Sec-Websocket-Accept: DGeZKxS98lD43p+4Gkhb17W29E0=
Connection: Upgrade

RabbitMQ is installed on CentOS 6.4 with the following versions for the server and Erlang
rabbitmq-server.noarch 3.1.5-1.el6 @epel
erlang.x86_64 R14B-04.2.el6 @epel

Could you guys look into this issue?

Br,
Petri

_______________________________________________
rabbitmq-discuss mailing list
[hidden email]
https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss
Reply | Threaded
Open this post in threaded view
|

Re: RabbitMQ's WebSocket broken

Michael Klishin-2
On 2 Nov 2013, at 14:14, Julian Lyndon-Smith <[hidden email]> wrote:

> did you ever get a solution to this problem ? I've got the same and it's driving me nuts :(

Julian,

There was no RabbitMQ release after this issue was reported
but there is a bug filed for this. It will take some time to determine
if the fix can go into a point release. We will post an update
here when that’s clear.

MK

Software Engineer, Pivotal/RabbitMQ


_______________________________________________
rabbitmq-discuss mailing list
[hidden email]
https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss
Reply | Threaded
Open this post in threaded view
|

Re: RabbitMQ's WebSocket broken

Julian Lyndon-Smith
thanks for the update

Julian

On 3 November 2013 19:11, Michael Klishin <[hidden email]> wrote:

> On 2 Nov 2013, at 14:14, Julian Lyndon-Smith <[hidden email]> wrote:
>
>> did you ever get a solution to this problem ? I've got the same and it's driving me nuts :(
>
> Julian,
>
> There was no RabbitMQ release after this issue was reported
> but there is a bug filed for this. It will take some time to determine
> if the fix can go into a point release. We will post an update
> here when that’s clear.
>
> MK
>
> Software Engineer, Pivotal/RabbitMQ
>
>
_______________________________________________
rabbitmq-discuss mailing list
[hidden email]
https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss
Reply | Threaded
Open this post in threaded view
|

Re: RabbitMQ's WebSocket broken

Sam Mitchell Finnigan
In reply to this post by Julian Lyndon-Smith-2
Hi Julian,

I just ran into this today- I'm currently working around it by falling back to javascript websockets (https://github.com/sockjs) if Chrome's native WS negotiation fails.

Cheers,
-Sam  

Julian Lyndon-Smith-2 wrote
Hey,

did you ever get a solution to this problem ? I've got the same and it's
driving me nuts :(

thanks

Julian

_______________________________________________
rabbitmq-discuss mailing list
[hidden email]
https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss