Skip to content

Commit 48635cc

Browse files
author
Addison
committed
Fixes issue mkschreder#16 (multiple Set-Cookie headers)
Also added .toString() to line 12 to avoid throwing a type-error.
1 parent 78f812b commit 48635cc

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

main.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ var path = require('path');
99
var fs = require('fs');
1010
var shell = require('shelljs');
1111

12-
var PHP_CGI = shell.which('php-cgi');
12+
var PHP_CGI = shell.which('php-cgi').toString();
1313

1414
if (!PHP_CGI) {
1515
throw new Error('"php-cgi" cannot be found');
@@ -189,6 +189,10 @@ function runPHP(req, response, next, url, file) {
189189
// console.log('HEADER: '+m[0]+': '+m[1]);
190190
if (m[0] == 'Status') {
191191
response.statusCode = parseInt(m[1]);
192+
}
193+
if (m[0] == 'Set-Cookie') {
194+
var prevCookies = response.getHeader('Set-Cookie');
195+
m[1] = prevCookies ? [prevCookies, m[1]] : m[1];
192196
}
193197
if (m.length == 2) {
194198
response.setHeader(m[0], m[1]);

0 commit comments

Comments
 (0)