|
|
@ -44,7 +44,7 @@ module Landline |
|
|
|
|
|
|
|
# Convert cookie to "Set-Cookie: " string representation. |
|
|
|
# @return [String] |
|
|
|
def to_s |
|
|
|
def finalize |
|
|
|
sign(@hmac, algorithm: @algorithm, sep: @sep) if @hmac |
|
|
|
ParserCommon.make_value( |
|
|
|
"#{key.to_s.strip}=#{value.to_s.strip}", |
|
|
@ -62,7 +62,8 @@ module Landline |
|
|
|
|
|
|
|
# Convert cookie to "Cookie: " string representation (no params) |
|
|
|
# @return [String] |
|
|
|
def to_short |
|
|
|
def finalize_short |
|
|
|
sign(@hmac, algorithm: @algorithm, sep: @sep) if @hmac |
|
|
|
"#{key.to_s.strip}=#{value.to_s.strip}" |
|
|
|
end |
|
|
|
|
|
|
@ -103,6 +104,8 @@ module Landline |
|
|
|
# @return [Hash{String => Cookie}] |
|
|
|
def self.from_cookie_string(data) |
|
|
|
hash = {} |
|
|
|
return hash if data.nil? |
|
|
|
|
|
|
|
data.split(";").map do |cookiestr| |
|
|
|
key, value = cookiestr.match(/([^=]+)=?(.*)/).to_a[1..].map(&:strip) |
|
|
|
cookie = Cookie.new(key, value) |
|
|
|