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

Setting Max-Age=X on a cookie is completely ignored #69

Open
oalders opened this issue Jul 1, 2022 · 4 comments
Open

Setting Max-Age=X on a cookie is completely ignored #69

oalders opened this issue Jul 1, 2022 · 4 comments

Comments

@oalders
Copy link
Member

oalders commented Jul 1, 2022

Reported via email by Robert Mueller.

In this commit dacc2b7 the max-age parameter is explicitly singled out to not discard, but unfortunately it introduces a bug because now we skip the main action of:

                else {
                    push(@cur, $k => $v);
                }

Which means it never ends up in @set, and thus never ends up in %hash, which means:

        my $maxage    = delete $hash{'max-age'};

Is always undef.

So basically setting Max-Age=X on a cookie is completely ignored in the current HTTP::Cookies 6.1

Changing:

                elsif (!$first_param && lc($k) eq 'max-age') {
                    $expires++;
                }

To:

                elsif (!$first_param && lc($k) eq 'max-age') {
                    $expires++;
                    push(@cur, "Max-Age" => $v);
                }

Fixes it.

@wolfsage
Copy link

wolfsage commented Jul 5, 2022

5 days ago. Nice. I just hit this

@oalders
Copy link
Member Author

oalders commented Jul 5, 2022

Oof. I just got the email about it shortly before the long weekend, so didn't take the time to create a patch and matching test. Was hoping some kind soul might pick this up. 😄

@wolfsage
Copy link

wolfsage commented Jul 5, 2022

I wish but this week it ain't me! Short week and vacation next week. Sorry!

@oalders
Copy link
Member Author

oalders commented Jul 5, 2022

In that case, I hope you enjoy your time off! 🌴 🌊 🏄‍♂️

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

No branches or pull requests

2 participants