http-useragent icon indicating copy to clipboard operation
http-useragent copied to clipboard

Respect response's Set-Cookie header on HTTP::Response#next-request

Open astj opened this issue 7 years ago • 2 comments

Currently, HTTP::Response#next-request doesn't care about Set-Cookie header of the response (understand just Location header). So, If someone wants to request with some received Cookie (like session Cookie), one has to set Cookie manually like following:

    my $next-req = $res.next-request;
    my $cookies = HTTP::Cookies.new;
    $cookies.extract-cookies($res);
    $next-req.add-cookies($cookies);

I think it's useful if HTTP::Response#next-request understands response's Set-Cookie header and automatically set Cookies to the next request.

astj avatar Nov 06 '16 14:11 astj

Yep, that's almost certainly right, I'll see if I can do that this afternoon without breaking anything.

jonathanstowe avatar Nov 06 '16 15:11 jonathanstowe

Hmm this would be fine, if the domain check was implemented properly on the add-cookies :(

I'm going to put another issue in to fix that first, before doing this, as I'd rather not be making things actually more insecure than they are.

jonathanstowe avatar Nov 06 '16 15:11 jonathanstowe