fukamachi / cl-cookie Goto Github PK
View Code? Open in Web Editor NEWHTTP cookie manager
HTTP cookie manager
In my project I receive the Set-Cookie value from soup-message-headers-get-list.
That function concatenates the multiple headers down to the allowed format defined in rfc2612 section 4.2.
Current result:
COOKIE> (parse-set-cookie-header
"name1=value; path=/; domain=.example.com; HttpOnly, name2=value; domain=.example.com; path=/; HttpOnly"
"example.com" "/")
#S(COOKIE
:NAME "name1"
:VALUE "value"
:EXPIRES NIL
:PATH "/"
:DOMAIN ".example.com"
:SECURE-P NIL
:HTTPONLY-P T
:ORIGIN-HOST "example.com")
Desired result:
COOKIE> (parse-set-cookie-header
"name1=value; path=/; domain=.example.com; HttpOnly, name2=value; domain=.example.com; path=/; HttpOnly"
"example.com" "/")
(#S(COOKIE
:NAME "name1"
:VALUE "value"
:EXPIRES NIL
:PATH "/"
:DOMAIN ".example.com"
:SECURE-P NIL
:HTTPONLY-P T
:ORIGIN-HOST "example.com")
#S(COOKIE
:NAME "name2"
:VALUE "value"
:EXPIRES NIL
:PATH "/"
:DOMAIN ".example.com"
:SECURE-P NIL
:HTTPONLY-P T
:ORIGIN-HOST "example.com"))
First, thank you for all you do for Common Lisp and its community.
I see that write-cookie-header
only writes a cookie's name
and value
while ignoring its other fields. For example,
(cl-cookie:write-cookie-header
(cl-cookie:make-cookie :name "name" :value "test" :path "/" :secure-p t :expires (encode-universal-time 6 22 19 25 1 2002)))
yields "name=test"
instead of the expected "name=test; Expires=Sat, 26 Jan 2002 00:22:06 GMT; Path=/; Secure"
.
What is the rationale behind this implementation? Should write-cookie-header
also handle a cookie's auxiliary attributes?
Running (ql:quickload "dexador")
gives me the following error:
................
;
; compilation unit aborted
; caught 1 fatal ERROR condition
; caught 1 ERROR condition
To load "dexador":
Load 1 ASDF system:
dexador
; Loading "dexador"
[package cl-cookie].
; file: /Users/adrienblavier/quicklisp/dists/quicklisp/software/cl-cookie-20220707-git/src/cl-cookie.lisp
; in: DEFUN GET-TZ-OFFSET
; (SYMBOL-MACROLET ((CL-COOKIE::TIMEZONES
; LOCAL-TIME::*ABBREVIATED-SUBZONE-NAME-
; NIL
; LOCAL-TIME::TIMEZONE-LIST*))
; (LET* ((CL-COOKIE::TZ
; (GETHASH CL-COOKIE::TZ-ABBREV CL-COOKIE::TIMEZONES NIL))
; (CL-COOKIE::TZ
; (IF CL-COOKIE::TZ
; #
; #)))
; (WHEN CL-COOKIE::TZ
; (LOOP CL-COOKIE::FOR CL-COOKIE::SUB CL-COOKIE::ACROSS (LOCAL-TIME::TIMEZONE-SUBZONES
; CL-COOKIE::TZ)
; WHEN (EQUAL CL-COOKIE::TZ-ABBREV #)
; DO (RETURN #)))))
;
; caught ERROR:
; malformed symbol/expansion pair: (TIMEZONES *ABBREVIATED-SUBZONE-NAME- NIL
; TIMEZONE-LIST*)
...............
I would like to expand the functionality to support the SameSite, Max-Age, Partitioned attribute. While trying to implement it some questions arose:
cookie=
and which in cookie-equal
?match-cookie
?max-age
value we have to include a creation time slot in the cookie
struct. Is the name creation-timestamp
okay?A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.