Set status and headers as soon as they are known, so they are available in case of an error.

This commit is contained in:
James Coglan
2013-05-12 14:49:59 +01:00
parent 28f8cbc7b3
commit 8cd6ff1dde
+3 -2
View File
@@ -67,6 +67,9 @@ module WebSocket
end
def validate_handshake
@status = @http.code
@headers = Headers.new(@http.headers)
unless @http.code == 101
return fail_handshake("Unexpected response code: #{@http.code}")
end
@@ -100,8 +103,6 @@ module WebSocket
end
end
@status = @http.code
@headers = Headers.new(@http.headers)
open
end
end