i have jumped too far into the bright future of the internet and found RFC 6265 to be an active standards about 50 years too early

This commit is contained in:
Yessiest 2024-07-06 22:36:33 +04:00
parent 0a6defe61d
commit a15e531fdc
2 changed files with 10 additions and 4 deletions

View File

@ -115,6 +115,8 @@ module Landline
data.split(";").map do |cookiestr| data.split(";").map do |cookiestr|
key, value = cookiestr.match(/([^=]+)=?(.*)/).to_a[1..].map(&:strip) key, value = cookiestr.match(/([^=]+)=?(.*)/).to_a[1..].map(&:strip)
next unless key and value
cookie = Cookie.new(key, value) cookie = Cookie.new(key, value)
if hash[cookie.key] if hash[cookie.key]
hash[cookie.key].append(cookie) hash[cookie.key].append(cookie)

View File

@ -15,12 +15,16 @@ module Landline
PRINTCHAR = /[\x2-\x7E]/ PRINTCHAR = /[\x2-\x7E]/
# Matches 1 or more CHARs excluding CTLs # Matches 1 or more CHARs excluding CTLs
PRINTABLE = /#{PRINTCHAR}+/o PRINTABLE = /#{PRINTCHAR}+/o
# !! RFC 6265 IS PROPOSED AND NOT AN IMPLEMENTED STANDARD YET !!
# Matches the RFC6265 definition of a cookie-octet # Matches the RFC6265 definition of a cookie-octet
COOKIE_OCTET = /[\x21-\x7E&&[^",;\\]]*/ # COOKIE_VALUE = /(?:#{QUOTED}|#{COOKIE_OCTET})/o
COOKIE_VALUE = /(?:#{QUOTED}|#{COOKIE_OCTET})/o # COOKIE_NAME = TOKEN
COOKIE_NAME = TOKEN
# Matches the RFC6265 definition of cookie-pair. # Matches the RFC6265 definition of cookie-pair.
# Captures name (1) and value (2). # Captures name (1) and value (2).
# !! RFC 6265 IS PROPOSED AND NOT AN IMPLEMENTED STANDARD YET !!
COOKIE_OCTET = /[\x21-\x7E&&[^",;\\]]*/
COOKIE_NAME = /[^;,=\s]*/
COOKIE_VALUE = /[^;,\s]*/
COOKIE_PAIR = /\A(#{COOKIE_NAME})=(#{COOKIE_VALUE})\z/o COOKIE_PAIR = /\A(#{COOKIE_NAME})=(#{COOKIE_VALUE})\z/o
# Matches a very abstract definition of a quoted header paramter. # Matches a very abstract definition of a quoted header paramter.
# Captures name (1) and value (2). # Captures name (1) and value (2).