cookiejar
cookiejar copied to clipboard
Error upon Max-Age in set-cookie header
I ran into a problem where I would not get any cookies set given this header:
"s=AAAAAAAAY1UAAAFJAB4UawAAAAAAAAAApPcqHqisJSmL4TuQ-RsJradrFZt9fTMSdEi8bw; Domain=.example.com; Path=/; HttpOnly; Secure; Max-Age=63072000"
Using set_cookies_from_headers
would not do anything, but also not yield any errors. Eventually after poking around in the source code I called the methods that set_cookies_from_headers
calls and found there to be errors:
CookieJar::Cookie.from_set_cookie("https://example.com/", "s=AAAAAAAAY1UAAAFJAB4UawAAAAAAAAAApPcqHqisJSmL4TuQ-RsJradrFZt9fTMSdEi8bw; Domain=.example.com; Path=/; HttpOnly; Secure; Max-Age=63072000").inspect
Error: #<CookieJar::InvalidCookieError: Unknown cookie parameter 'max-age'>
C:/Users/Thomas/AppData/Roaming/SketchUp/SketchUp 2015/SketchUp/Gems64/gems/cookiejar-0.3.2/lib/cookiejar/cookie_validation.rb:324:in `block in parse_set_cookie'
C:/Users/Thomas/AppData/Roaming/SketchUp/SketchUp 2015/SketchUp/Gems64/gems/cookiejar-0.3.2/lib/cookiejar/cookie_validation.rb:297:in `each'
C:/Users/Thomas/AppData/Roaming/SketchUp/SketchUp 2015/SketchUp/Gems64/gems/cookiejar-0.3.2/lib/cookiejar/cookie_validation.rb:297:in `parse_set_cookie'
C:/Users/Thomas/AppData/Roaming/SketchUp/SketchUp 2015/SketchUp/Gems64/gems/cookiejar-0.3.2/lib/cookiejar/cookie.rb:92:in `from_set_cookie'
<main>:in `<main>'
SketchUp:1:in `eval'
Should it really raise errors upon unknown value? Or rather ignore those and yet save the cookie using the value it does now. I'd prefer that former.
Any workaround for this?