cli
cli copied to clipboard
Don't expire cookie with later setting in the same headers
I'm interacting with a server that likes to simultaneously expire a cookie and give it a new value in the same headers:
Set-Cookie: JSESSIONID=expire; Max-Age=0; Expires=Thu, 01-Jan-1970 00:00:10 GMT; Path=/
Set-Cookie: JSESSIONID=ED0E0934E642AC44A7ACDE6CED16D904; Path=/; Secure; HttpOnly
This isn't spec, as I understand it, but it turns out the browsers don't care. They just use the last value given.
So this PR updates httpie to behave in the same way, by ignoring an earlier expiration in favor of a later setting in the same headers.
Without this change, httpie drops the cookie rather than setting it, which makes interacting with this particular server quite difficult.