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

Cookies from original request cannot be combined with response cookies in session file #824

Closed
strindberg opened this issue Dec 8, 2019 · 3 comments
Labels
bug Something isn't working help wanted Extra attention is needed sessions

Comments

@strindberg
Copy link

strindberg commented Dec 8, 2019

Consider the following request:

https --session=/tmp/c-session "https://localhost:8721/customer/business/1" Cookie:sAuth=foo6

If the server sets cookies XSRF-TOKEN and JSESSIONID, the session file will look like this:

{
    "__meta__": {
        "about": "HTTPie session file",
        "help": "https://httpie.org/doc#sessions",
        "httpie": "1.0.3"
    },
    "auth": {
        "password": null,
        "type": null,
        "username": null
    },
    "cookies": {
        "JSESSIONID": {
            "expires": null,
            "path": "/",
            "secure": true,
            "value": "091642DF767443D96E72C6FDEE561428"
        },
        "XSRF-TOKEN": {
            "expires": null,
            "path": "/",
            "secure": true,
            "value": "af6eb371-ce07-4583-bdce-efbfa09728f9"
        }
    },
    "headers": {
        "Cookie": "sAuth=foo6"
    }
}

When the request is repeated with the same session file (but without the sAuth given on the command line), the result is that only the cookie sAuth is sent, not the cookies JSESSIONID and XSRF-TOKEN:

https --verbose --session=/tmp/c-session "https://localhost:8721/apis/customer/business/1"

Request:

GET /apis/customer/business/1 HTTP/1.1
Accept: */*
Accept-Encoding: gzip, deflate
Connection: keep-alive
Cookie: saamAuth=foo6
Host: localhost:8721
User-Agent: HTTPie/1.0.3

I would have expected to have all three cookies set in the request.

@jkbrzt jkbrzt added bug Something isn't working help wanted Extra attention is needed labels Jun 9, 2020
@jkbrzt jkbrzt added the sessions label Jun 9, 2020
@kbanc
Copy link
Contributor

kbanc commented Jun 12, 2020

@jakubroztocil Can I look into this?

@jkbrzt
Copy link
Member

jkbrzt commented Jun 12, 2020

@kbanc sure thing! (As always, I’d start by writing a test case reproducing the behavior and clarifying the problem.)

@isidentical
Copy link
Contributor

If I am not missing anything, this seem to be fixed by @kbanc on #932. If the issue is still persisting, please let us know by creating another ticket.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed sessions
Projects
None yet
Development

No branches or pull requests

4 participants