카테고리 없음

web socket - Sec-WebSocket-Key

안녕1999 2017. 4. 20. 23:30

웹소켓 헤더에서, Sec-WebSocket-Key의 존재이유

=> 일반 웹서버가 잘못된 요청을 받지 않도록 하기 위함(클라이언트가 끊어버림)

그러나, 이 말은 좀 모순되어 보인다.
악의적인 클라이언트라면, 무조건 전송할것이다.
클라이언트 입장에서보면, 서버가 웹소켓을 지원하는지 판단하는 기준이나,
너무 복잡하게 되어 있다.
헤더에, 간단하게 "web-socket : ok"+시간정보(캐시데이터 확인용) 등의 문자열만 확인하면 되는데 말이다.
쓸데없이 너무 복잡하게만들어, 작은 웹소켓 서버 제작에 작은(?) 걸림돌이 되고있다.


http://stackoverflow.com/questions/18265128/what-is-sec-websocket-key-for

".. the server has to prove to the client that it received the client's WebSocket handshake, so that the server doesn't accept connections that are not WebSocket connections."

and:

"This helps ensure that the server does not accept connections from non-WebSocket clients .."