Add fix for HTTP::Cookies

このコミットが含まれているのは:
Omar Roth 2018-03-16 12:06:03 -05:00
コミット 6581f96b70
2個のファイルの変更29行の追加0行の削除

28
src/cookie_fix.cr ノーマルファイル
ファイルの表示

@ -0,0 +1,28 @@
module HTTP
class Cookie
module Parser
SetCookieStringFix = /^#{Regex::CookiePair}(?:;\s*#{Regex::CookieAV})*$/
def parse_set_cookie(header)
match = header.match(SetCookieStringFix)
return unless match
expires = if max_age = match["max_age"]?
Time.now + max_age.to_i.seconds
else
parse_time(match["expires"]?)
end
Cookie.new(
match["name"], match["value"],
path: match["path"]? || "/",
expires: expires,
domain: match["domain"]?,
secure: match["secure"]? != nil,
http_only: match["http_only"]? != nil,
extension: match["extension"]?
)
end
end
end
end

ファイルの表示

@ -20,6 +20,7 @@ require "pg"
require "xml"
require "yaml"
require "./helpers"
require "./cookie_fix"
CONFIG = Config.from_yaml(File.read("config/config.yml"))