Websocketd: support for crystal 0.31.0

master
Philippe PITTOLI 2019-09-29 18:39:47 +02:00
parent d6e0bd4a2f
commit 550f4e77ae
2 changed files with 7 additions and 2 deletions

View File

@ -1,5 +1,5 @@
name: networkd name: networkd
version: 0.1.0 version: 0.1.1
authors: authors:
- karchnu <karchnu@karchnu.fr> - karchnu <karchnu@karchnu.fr>

View File

@ -122,10 +122,15 @@ def websocket_client_connection(client, context : InstanceStorage)
raise "#REQUEST IS NIL" raise "#REQUEST IS NIL"
end end
if request.is_a? HTTP::Request::BadRequest if request.is_a? HTTP::Status && request == HTTP::Status::BAD_REQUEST
raise "BAD REQUEST DAZE~" raise "BAD REQUEST DAZE~"
end end
if request.is_a? HTTP::Status
raise "Not bad request but still pretty bad: #{request.to_s}"
end
# FIXME: check they actually wanted to upgrade to websocket # FIXME: check they actually wanted to upgrade to websocket
key = request.headers["Sec-WebSocket-Key"] key = request.headers["Sec-WebSocket-Key"]
response_key = Digest::SHA1.base64digest key + "258EAFA5-E914-47DA-95CA-C5AB0DC85B11" response_key = Digest::SHA1.base64digest key + "258EAFA5-E914-47DA-95CA-C5AB0DC85B11"