Paste number 10504: Example of using rfc2109.lisp on Araneida

Index of paste annotations: 1

Paste number 10504: Example of using rfc2109.lisp on Araneida
Pasted by: alanshields
When:8 years, 8 months ago
Share:Tweet this! | http://paste.lisp.org/+83S
Channel:None
Paste contents:
Raw Source | XML | Display As
(defmethod handle-request-response ((handler cookie-monster) method request)
  (let ((my-cookie (cookie1:cookie-string "dascookie" "goes down" :max-age 600 :domain "inquisitor.omrf.org"))
	(my-hack-cookie (cookie1:cookie-string "secret" "squirrel?" :max-age 600 :domain ".omrf.org"))
	(my-domainless-cookie (cookie1:cookie-string "no" "domain name from \\\"hell!\\\"" :max-age 600))
	(received-cookies (request-header request :cookie))
	(parsed-cookies (loop for cookie-string in (request-header request :cookie)
			      collect (cookie1:parse-cookies cookie-string)))
	(safe-parsed-cookies (loop for cookie-string in (request-header request :cookie)
				   collect (cookie1:safe-parse-cookies cookie-string "inquisitor.omrf.org"))))
    (request-send-headers request :set-cookie (list my-cookie my-hack-cookie my-domainless-cookie))
    (html-stream
     (request-stream request)
     `(body
       (p "Welcome to the jungle!")
       (p "Gave cookie: " ,my-cookie)
       (p "Gave cookie (no domain specified): " ,my-domainless-cookie)
       (p "Also gave cookie (spoof attack): " ,my-hack-cookie)
       (p "Raw cookies: " (pre ,received-cookies))
       (p "Parsed cookies: " (pre ,(write-to-string parsed-cookies)))
       (p "Safe parsed cookies: " (pre ,(write-to-string safe-parsed-cookies)))))))

Annotations for this paste:

Annotation number 1: fghfdgh
Pasted by: ghfgh
When:8 years, 6 months ago
Share:Tweet this! | http://paste.lisp.org/+83S/1
Paste contents:
Raw Source | Display As
fghfgh

Colorize as:
Show Line Numbers

Lisppaste pastes can be made by anyone at any time. Imagine a fearsomely comprehensive disclaimer of liability. Now fear, comprehensively.