M
M
Maxim Barulin2016-01-22 16:42:50
Mozilla Firefox
Maxim Barulin, 2016-01-22 16:42:50

[Web Sockets] Mozilla sends a request on a new connection after a handshake. What to answer her?

Good day!

Today I ran into a problem. There is a server that handles connections via web sockets. When establishing a connection, the mozilla makes two requests, the first one is actually a handshake, the server responds to it, but then for some reason it closes the current connection, opens a new one and sends it like this: 63f1b2437c9e4fcfb7d7a85c5ab745bf.pngand everything would be fine if everything happened within the same connection. But no, she closes it and opens a new one. Accordingly, to determine what kind of nonsense it came from and where it came from. Chrome doesn't suffer like that. Who knows why mozilla does such a thing? Am I missing something in the protocol?

Requests:

[{<<"Host">>,<<"host.ru:111">>},
  {<<"User-Agent">>,
   <<"Mozilla/5.0 (Windows NT 6.1; WOW64; rv:41.0) Gecko/20100101 Firefox/41.0">>},
  {<<"Accept">>,
   <<"text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8">>},
  {<<"Accept-Language">>,<<"ru-RU,ru;q=0.8,en-US;q=0.5,en;q=0.3">>},
  {<<"Accept-Encoding">>,<<"gzip, deflate">>},
  {<<"Sec-WebSocket-Version">>,<<"13">>},
  {<<"Origin">>,<<"http://host2.ru">>},
  {<<"Sec-WebSocket-Extensions">>,<<"permessage-deflate">>},
  {<<"Sec-WebSocket-Key">>,<<"IsoYCcUHGPU/+m1A72/Mxw==">>},
  {<<"Cookie">>,
   <<"">>},
  {<<"Connection">>,<<"keep-alive, Upgrade">>},
  {<<"Pragma">>,<<"no-cache">>},
  {<<"Cache-Control">>,<<"no-cache">>},
  {<<"Upgrade">>,<<"websocket">>}]


server response: <<"HTTP/1.1 101 Switching Protocols\r\nUpgrade: WebSocket\r\nConnection: Upgrade\r\nSec-WebSocket-Accept: Cv69Tz3lk8p3p6vGupJIE+pS7ws=\r\n\r\n">>

After that mozilla opens a new connection and sends there:
[{<<"Host">>,<<"host.ru:111">>},
  {<<"User-Agent">>,
   <<"Mozilla/5.0 (Windows NT 6.1; WOW64; rv:41.0) Gecko/20100101 Firefox/41.0">>},
  {<<"Accept">>,
   <<"text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8">>},
  {<<"Accept-Language">>,<<"ru-RU,ru;q=0.8,en-US;q=0.5,en;q=0.3">>},
  {<<"Accept-Encoding">>,<<"gzip, deflate">>},
  {<<"Referer">>,<<"http://host2.ru/">>},
  {<<"Cookie">>,
   <<"">>},
  {<<"Connection">>,<<"keep-alive">>}]

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question