httpclient icon indicating copy to clipboard operation
httpclient copied to clipboard

Cookies with a SameSite attribute cause a warning to be output

Open jjensen-ebsco opened this issue 6 years ago • 2 comments

https://github.com/nahi/httpclient/blob/27fbb07685930d1c8dbdc8dd1e72027f79879bbe/lib/httpclient/webagent-cookie.rb#L187

The case statement in the parse function of the Cookie class does not expect the "SameSite" attribute of a cookie. Servers will send this attribute, which causes unnecessary output.

I believe that this can be temporarily fixed by adding an empty when clause before the else clause:

...
when 'samesite'
else
...

A proper fix should probably add an attr_accessor :samesite and other code to manage the potential values for the "SameSite" attribute.

jjensen-ebsco avatar Dec 17 '19 22:12 jjensen-ebsco

Since Ruby 2.5 there's the Warning module that one can use to customise Kernel#warn. The gem warning adds some extra utils.

We've used it as follows to silence this annoying line:

# Add to gemfile
gem `warnings`

# Add to your codebase:
Warning.ignore(/Unknown key: SameSite = Lax/)

dv avatar Jun 01 '20 09:06 dv

Since Ruby 2.5 there's the Warning module that one can use to customise Kernel#warn. The gem warning adds some extra utils.

We've used it as follows to silence this annoying line:

# Add to gemfile
gem `warnings`

# Add to your codebase:
Warning.ignore(/Unknown key: SameSite = Lax/)

works as long as you install "warning" and not "warnings"

sroller avatar Sep 15 '22 21:09 sroller