Skip to content

Commit db4201d

Browse files
committed
Support multiple cookies for follow_set_cookies
It appears that cookies.js expects the format ofthe `Set Cookies` header to function. This sounds reasonable, but the original request cookies are stored as a string not as key-value pair strings, so it needs to be separated again to be forwarded correctly in the redirect.
1 parent f9d554e commit db4201d

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

lib/needle.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -525,7 +525,7 @@ Needle.prototype.send_request = function(count, method, uri, config, post_data,
525525
// if follow_set_cookies is true, insert cookies in the next request's headers.
526526
// we set both the original request cookies plus any response cookies we might have received.
527527
if (config.follow_set_cookies && utils.host_and_ports_match(headers.location, uri)) {
528-
var request_cookies = cookies.read(config.headers['cookie']);
528+
var request_cookies = cookies.read(config.headers['cookie'].split(';'));
529529
config.previous_resp_cookies = resp.cookies;
530530
if (Object.keys(request_cookies).length || Object.keys(resp.cookies || {}).length) {
531531
config.headers['cookie'] = cookies.write(extend(request_cookies, resp.cookies));

0 commit comments

Comments
 (0)