Use raw headers instead parsed.

Set-Cookie headers are parsed into single header with cookies in array.
This messes up the Set-Cookie headers, because browser receives multiple Set-Cookie headers as single with cookies separted with comma.
This commit is contained in:
Arttu Liimola 2015-08-27 12:53:43 +03:00 committed by Jarrett Cruger
parent 931f73dc98
commit 8bfd90c4d9

View File

@ -114,8 +114,10 @@ var passes = exports;
if (proxyHead && proxyHead.length) proxySocket.unshift(proxyHead);
socket.write('HTTP/1.1 101 Switching Protocols\r\n');
socket.write(Object.keys(proxyRes.headers).map(function(i) {
return i + ": " + proxyRes.headers[i];
socket.write(proxyRes.rawHeaders.map(function(v, i, a) {
return !(i % 2) ? v + ": " + a[i+1] : null;
}).filter(function (v) {
return v ? true : false;
}).join('\r\n') + '\r\n\r\n');
proxySocket.pipe(socket).pipe(proxySocket);