mirror of
https://github.com/samsonjs/http-cookie.git
synced 2026-04-27 14:57:46 +00:00
Apply minor code improvements.
This commit is contained in:
parent
9768154e82
commit
1a7c38e9e0
1 changed files with 3 additions and 3 deletions
|
|
@ -180,14 +180,14 @@ class HTTP::Cookie
|
||||||
date ||= Time.now
|
date ||= Time.now
|
||||||
|
|
||||||
[].tap { |cookies|
|
[].tap { |cookies|
|
||||||
set_cookie.split(/,(?=[^;,]*=)|,$/).each { |c|
|
# The expires attribute may include a comma in the value.
|
||||||
|
set_cookie.split(/,(?=[^;,]*=|\s*\z)/).each { |c|
|
||||||
if c.bytesize > MAX_LENGTH
|
if c.bytesize > MAX_LENGTH
|
||||||
logger.warn("Cookie definition too long: #{c}") if logger
|
logger.warn("Cookie definition too long: #{c}") if logger
|
||||||
next
|
next
|
||||||
end
|
end
|
||||||
|
|
||||||
cookie_elem = c.split(/;+/)
|
first_elem, *cookie_elem = c.split(/;+/)
|
||||||
first_elem = cookie_elem.shift
|
|
||||||
first_elem.strip!
|
first_elem.strip!
|
||||||
key, value = first_elem.split(/\=/, 2)
|
key, value = first_elem.split(/\=/, 2)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue