From: Amirouche <amirouche@hypermove.net>
To: guile-devel@gnu.org
Subject: Re: What is needed in guildhall to include it in Guile?
Date: Wed, 1 Mar 2017 21:34:57 +0100 [thread overview]
Message-ID: <ab49e885-48f9-3c6d-c460-ebb2ca33eec5@hypermove.net> (raw)
In-Reply-To: <aed757f9-d974-547c-6d8f-a864be48799c@hypermove.net>
Le 01/03/2017 à 20:35, Amirouche a écrit :
> Le 23/02/2016 à 17:57, Arne Babenhauserheide a écrit :
> That said I have an issue with registration/login
> stuff anything related with setting cookies I don't find a good
> abstraction,
> for it.
>
> I keep you posted.
So I found a solution that satisfy me. Here is it:
(define (pair->set-cookie item)
`(Set-Cookie . ,(string-append (symbol->string (car item))
"="
(cadr item))))
(define (sxml->set-cookies sxml)
(match sxml
((('doctype doctype)
('html ('@ . options) . rest))
(map pair->set-cookie options))
(_ '())))
(define (sxml->response sxml)
(let ((set-cookies (sxml->set-cookies sxml)))
(values `((content-type . (text/html)) ,@set-cookies)
(lambda (port)
(sxml->html sxml port)))))
;;; handler
(define (handler request body)
(sxml->response `((doctype "html")
(html
(body "echo")))))
(format #t "Héllo! Go to http://localhost:8080\n")
(run-server handler))
amz3
next prev parent reply other threads:[~2017-03-01 20:34 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-22 15:08 What is needed in guildhall to include it in Guile? Arne Babenhauserheide
2016-02-22 17:57 ` Nala Ginrut
2016-02-23 16:57 ` Arne Babenhauserheide
2016-02-23 22:50 ` Arne Babenhauserheide
2016-03-23 19:32 ` Arne Babenhauserheide
2016-03-23 22:54 ` Christopher Allan Webber
2017-03-01 19:35 ` Amirouche
2017-03-01 20:34 ` Amirouche [this message]
2017-03-03 23:05 ` Amirouche
2016-02-22 18:17 ` Christopher Allan Webber
2016-02-22 19:18 ` Jan Nieuwenhuizen
2016-02-22 20:26 ` Panicz Maciej Godek
-- strict thread matches above, loose matches on Subject: below --
2016-02-22 15:08 Arne Babenhauserheide
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/guile/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ab49e885-48f9-3c6d-c460-ebb2ca33eec5@hypermove.net \
--to=amirouche@hypermove.net \
--cc=guile-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).