mirror of
https://github.com/vale981/emacs-jupyter
synced 2025-03-05 07:41:37 -05:00
jupyter-api-copy-cookies-for-websocket: Ensure cookies have expiration date
This commit is contained in:
parent
36aec72814
commit
816a30f5a7
1 changed files with 16 additions and 0 deletions
|
@ -321,6 +321,22 @@ see RFC 6265."
|
||||||
do (pcase-let (((cl-struct url-cookie name value expires
|
do (pcase-let (((cl-struct url-cookie name value expires
|
||||||
localpart secure)
|
localpart secure)
|
||||||
cookie))
|
cookie))
|
||||||
|
;; Set the expiration date if it does not have one already since
|
||||||
|
;; `url-cookie-clean-up' (called by `url-cookie-write-file') will
|
||||||
|
;; correctly drop any cookies that don't have an expiration date
|
||||||
|
;; since cookies are required to have them.
|
||||||
|
;;
|
||||||
|
;; FIXME: This is mainly for the _xsrf cookie which does not have an
|
||||||
|
;; expiration date which I believe is to be interpreted as meaning
|
||||||
|
;; the cookie is session based. We go through `url-cookie-write-file'
|
||||||
|
;; so that the subprocess which starts websockets can read the
|
||||||
|
;; required cookies. An alternative solution would be to pass the
|
||||||
|
;; cookies directly to the subprocess.
|
||||||
|
(unless expires
|
||||||
|
(setq expires (setf (url-cookie-expires cookie)
|
||||||
|
(format-time-string "%a, %d %b %Y %T %z"
|
||||||
|
(time-add (current-time)
|
||||||
|
(days-to-time 1))))))
|
||||||
(url-cookie-store name value expires host-port localpart secure)))))
|
(url-cookie-store name value expires host-port localpart secure)))))
|
||||||
|
|
||||||
(defun jupyter-api-add-websocket-headers (plist)
|
(defun jupyter-api-add-websocket-headers (plist)
|
||||||
|
|
Loading…
Add table
Reference in a new issue