From f618634bf648124c9562aaf49ee460be9ef71ae7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Hoguin?= Date: Fri, 10 Apr 2015 17:34:26 +0300 Subject: Add headers to gun_ws_upgrade message Also improves the code and documentation about this message. It was incorrectly specified that a gun_ws_upgrade message could be sent on error; instead a gun_response is sent. --- src/gun_http.erl | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/gun_http.erl') diff --git a/src/gun_http.erl b/src/gun_http.erl index 6e65341..67c235f 100644 --- a/src/gun_http.erl +++ b/src/gun_http.erl @@ -452,11 +452,11 @@ ws_validate_extensions(_, _, _, _) -> close. %% @todo Validate protocols. -ws_handshake_protocols(Buffer, State, _Headers, Extensions, _GunProtocols = []) -> +ws_handshake_protocols(Buffer, State, Headers, Extensions, _GunProtocols = []) -> Protocols = [], - ws_handshake_end(Buffer, State, Extensions, Protocols). + ws_handshake_end(Buffer, State, Headers, Extensions, Protocols). -ws_handshake_end(Buffer, #http_state{owner=Owner, socket=Socket, transport=Transport}, Extensions, Protocols) -> +ws_handshake_end(Buffer, #http_state{owner=Owner, socket=Socket, transport=Transport}, Headers, Extensions, Protocols) -> %% Send ourselves the remaining buffer, if any. _ = case Buffer of <<>> -> @@ -465,4 +465,4 @@ ws_handshake_end(Buffer, #http_state{owner=Owner, socket=Socket, transport=Trans {OK, _, _} = Transport:messages(), self() ! {OK, Socket, Buffer} end, - gun_ws:init(Owner, Socket, Transport, Extensions, Protocols). + gun_ws:init(Owner, Socket, Transport, Headers, Extensions, Protocols). -- cgit v1.2.3