cli: Cookies not correctly updated within a --follow redirect chain
Hello,
when site creates new session for user, the PHPSESSID is not overrided but both the old and the new one is sent. Please notice Cookie header in last request. I’m using httpie version 0.9.8.
» http --verbose --session=/tmp/yamaha.json --form --follow POST https://www.yamaha-extranet.com/login/index email=foo@bar.baz password=bar submitform=Submit
POST /login/index HTTP/1.1
Cookie: PHPSESSID=mdslhb7u0giujsaf8itq2gm2p0
Host: www.yamaha-extranet.com
User-Agent: HTTPie/0.9.8
email=****&submitform=Submit
HTTP/1.1 302 Found
Location: /
Set-Cookie: PHPSESSID=nb7qnhkfjsdtpe8gtj797koaq7; path=/; domain=www.yamaha-extranet.com; secure
X-Powered-By: PHP/5.5.38
GET / HTTP/1.1
Accept: */*
Accept-Encoding: gzip, deflate
Connection: keep-alive
Cookie: PHPSESSID=mdslhb7u0giujsaf8itq2gm2p0; PHPSESSID=nb7qnhkfjsdtpe8gtj797koaq7
Host: www.yamaha-extranet.com
User-Agent: HTTPie/0.9.8
Session file contains only one PHPSESSID though.
{
"__meta__": {
"about": "HTTPie session file",
"help": "https://httpie.org/docs#sessions",
"httpie": "0.9.8"
},
"auth": {
"password": null,
"type": null,
"username": null
},
"cookies": {
"PHPSESSID": {
"expires": null,
"path": "/",
"secure": true,
"value": "nb7qnhkfjsdtpe8gtj797koaq7"
}
},
"headers": {}
}
About this issue
- Original URL
- State: open
- Created 6 years ago
- Reactions: 2
- Comments: 17 (8 by maintainers)
Commits related to this issue
- Fix bug #662 by saving domain for cookies — committed to codeprentice-org/httpie by asifmallik 4 years ago
- Fix bug #662 - save domain in sessions file — committed to barny/httpie by barny 2 years ago
@asifmallik luckily,
/cookies/set
also redirects. So this is how you can reproduce it:1. prepare a session with a cookie
2. call
/cookies/set
It should also handle and have tests for
--session-readonly
(cookies should be assigned after each request, but the session file shoud not be updated).