diff --git a/http2.d b/http2.d index 9d9e5a0..3003ba1 100644 --- a/http2.d +++ b/http2.d @@ -4618,6 +4618,7 @@ class WebSocket { socket = new Socket(family(uri.unixSocketPath), SocketType.STREAM); socket.setOption(SocketOptionLevel.TCP, SocketOption.TCP_NODELAY, 1); + cookies = config.cookies; } /++ @@ -4704,6 +4705,24 @@ class WebSocket { // FIXME: randomize this append("Sec-WebSocket-Key: x3JEHMbDL1EzLkh9GBhXDw==\r\n"); + if(cookies.length > 0) { + append("Cookie: "); + bool first=true; + foreach(k,v;cookies) { + if(first) first = false; + else append("; "); + append(k); + append("="); + append(v); + } + append("\r\n"); + } + /* + //This is equivalent but has dependencies + import std.format; + import std.algorithm : map; + append(format("cookie: %-(%s %)\r\n",cookies.byKeyValue.map!(t=>format("%s=%s",t.key,t.value)))); + */ if(config.protocol.length) append("Sec-WebSocket-Protocol: ", config.protocol, "\r\n");