Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cookie header not respected #507

Closed
sstoychev opened this issue Feb 3, 2020 · 3 comments
Closed

Cookie header not respected #507

sstoychev opened this issue Feb 3, 2020 · 3 comments
Labels

Comments

@sstoychev
Copy link

  • VSCode Version:
    Version: 1.42.0-insider (user setup)
    Commit: 705f01577dd37d6f17eaa683ab89b0c392fa1a7c
    Date: 2020-02-03T14:02:55.075Z
    Electron: 6.1.6
    Chrome: 76.0.3809.146
    Node.js: 12.4.0
    V8: 7.6.303.31-electron.0
    OS: Windows_NT x64 10.0.18363

Version: 1.41.1 (system setup)
Commit: 26076a4de974ead31f97692a0d32f90d735645c0
Date: 2019-12-18T14:58:56.166Z
Electron: 6.1.5
Chrome: 76.0.3809.146
Node.js: 12.4.0
V8: 7.6.303.31-electron.0
OS: Windows_NT x64 10.0.18363

  • OS Version: Windows 10 1909
  • REST Client Version: 0.23.1

Steps to Reproduce:

  1. Create post request:
###
// @no-cookie-jar
POST https://path/to/api HTTP/1.1
Content-Type: application/json
Cookie: PHPSESSID=9otvfj28tnc2oe9eqsmrvpjrg3; cookieconsent_status=dismiss; track=f5ca56107623a2c2968519af772717879fbc38a2; __cfduid=d866f3becc9ac80dec0c74fd8368780241580144118

{
    "var1": 1221,
    "var2": 727152,
    "var3": 727155
}

###
  1. "rest-client.rememberCookiesForSubsequentRequests": false
  2. On the server side the session is different and you get response that you are not authorized. Actually the Cookie header is added to an old cookie:
    [HTTP_COOKIE] => PHPSESSID=c9fa74hogtlrk8ps4n7kkotbf6; __cfduid=d368c4857dd30d9cb59e215c432466aa01567431688; PHPSESSID=9otvfj28tnc2oe9eqsmrvpjrg3; cookieconsent_status=dismiss; track=f5ca56107623a2c2968519af772717879fbc38a2; __cfduid=d866f3becc9ac80dec0c74fd8368780241580144118

The very first time when I run the request it was without Cookie header and I got 'HTTP/1.1 401 Unauthorized', which is normal. I had "rest-client.rememberCookiesForSubsequentRequests": true, (the default value) at the moment.
Then I set the header but I still got the same, changed "rest-client.rememberCookiesForSubsequentRequests": false, but without any success.

I believe
PHPSESSID=c9fa74hogtlrk8ps4n7kkotbf6; __cfduid=d368c4857dd30d9cb59e215c432466aa01567431688; is from the first run when I didn't set the Cookie header.

I tried on both VSCode insiders and stable, and also tried to disable the extension, close VSCode, restart it, enable the extension and run the request again, but it is still adding the header to the old cookie.

The very same code (the very same file) works with PHPStorm - note @no-cookie-jar, which is the same setting as
"rest-client.rememberCookiesForSubsequentRequests": false
for VSCode. The session is not expired and is valid. The server is remote with lighttpd if it matters.

@Huachao Huachao added the bug label Feb 4, 2020
Huachao added a commit that referenced this issue Feb 4, 2020
@Huachao
Copy link
Owner

Huachao commented Feb 4, 2020

@sstoychev this will be fixed in the next release.

@Huachao
Copy link
Owner

Huachao commented Mar 9, 2020

@sstoychev you can verify this in the latest version 0.23.2

@sstoychev
Copy link
Author

Yes, it is working. Sorry for the late reply

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants