1 |
;;; www/cgi.scm --- Common Gateway Interface support for WWW scripts |
;;; www/cgi.scm --- Common Gateway Interface support for WWW scripts |
2 |
|
|
3 |
;; Copyright (C) 1997,2001,2002 Free Software Foundation, Inc. |
;; Copyright (C) 1997,2001,2002, 2003 Free Software Foundation, Inc. |
4 |
;; |
;; |
5 |
;; This program is free software; you can redistribute it and/or modify |
;; This program is free software; you can redistribute it and/or modify |
6 |
;; it under the terms of the GNU General Public License as published by |
;; it under the terms of the GNU General Public License as published by |
124 |
;; path associated with the cookie. |
;; path associated with the cookie. |
125 |
;; (cgi:cookies NAME) |
;; (cgi:cookies NAME) |
126 |
;; Fetch the first cookie value associated with NAME. |
;; Fetch the first cookie value associated with NAME. |
127 |
;; (cgi:make-cookie NAME VALUE #&key path domain expires secure) |
;; (cgi:make-cookie NAME VALUE #:key path domain expires secure) |
128 |
;; Create a cookie suitable for inclusion into an HTTP response |
;; Create a cookie suitable for inclusion into an HTTP response |
129 |
;; header. Recognize optional parameters path, doman, expires, |
;; header. Recognize optional parameters path, doman, expires, |
130 |
;; (which should be strings) and secure (which is boolean). |
;; (which should be strings) and secure (which is boolean). |
173 |
(and cookie-values (car cookie-values)))) |
(and cookie-values (car cookie-values)))) |
174 |
|
|
175 |
(define-public cgi:make-cookie |
(define-public cgi:make-cookie |
176 |
(lambda* (name value #&key path domain expires secure) |
(lambda* (name value #:key path domain expires secure) |
177 |
(format #f "Set-Cookie: ~A=~A~A~A~A~A" |
(format #f "Set-Cookie: ~A=~A~A~A~A~A" |
178 |
name value |
name value |
179 |
(if (bound? path) |
(if path |
180 |
(format #f "; path=~A" path) "") |
(format #f "; path=~A" path) "") |
181 |
(if (bound? domain) |
(if domain |
182 |
(format #f "; domain=~A" domain) "") |
(format #f "; domain=~A" domain) "") |
183 |
(if (bound? expires) |
(if expires |
184 |
(format #f "; expires=~A" expires) "") |
(format #f "; expires=~A" expires) "") |
185 |
(if (and (bound? secure) secure) |
(if secure |
186 |
"; secure" "")))) |
"; secure" "")))) |
187 |
|
|
188 |
|
|