serviejs/popsicle

getAttachCookies appends cookies even though this is against the RFC

XuluWarrior opened this issue · 4 comments

Using a cookies jar, I was having issues with after login POST, future requests still behaved as if I wasn't logged in.

I traced this down to getAttachedCookies which calls request.set('Cookie', /* original cookies from request*/) followed by request.append('Cookie', /* Jar cookies */)

The server I was connecting to was obviously taking offense to the multiple cookie headers and according to the RFC it is correct to do so.

http://stackoverflow.com/questions/16305814/are-multiple-cookie-headers-allowed-in-an-http-request

Replacing 'append' with 'set' fixed my login issues but that obviously overwrites rather than merges the two cookie sources.

Sounds like a reasonable fix, sorry about that. There should definitely be one header, I'll check what it would take (if it doesn't already) to make sure redirections handle cookies properly.

Great! That works for me. Thanks for the prompt fix.