From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Amirouche Newsgroups: gmane.lisp.guile.devel Subject: Re: What is needed in guildhall to include it in Guile? Date: Wed, 1 Mar 2017 21:34:57 +0100 Message-ID: References: <87k2lw1yvd.fsf@web.de> <1456163829.7330.32.camel@Renee-desktop.suse> <87fuwj1hjq.fsf@web.de> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-Trace: blaine.gmane.org 1488400534 8998 195.159.176.226 (1 Mar 2017 20:35:34 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Wed, 1 Mar 2017 20:35:34 +0000 (UTC) User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.7.0 To: guile-devel@gnu.org Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Wed Mar 01 21:35:28 2017 Return-path: Envelope-to: guile-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cjAy4-0001Pc-JS for guile-devel@m.gmane.org; Wed, 01 Mar 2017 21:35:24 +0100 Original-Received: from localhost ([::1]:48677 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cjAyA-0000nc-Mi for guile-devel@m.gmane.org; Wed, 01 Mar 2017 15:35:30 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:55003) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cjAxs-0000gj-Q9 for guile-devel@gnu.org; Wed, 01 Mar 2017 15:35:13 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cjAxo-0006Rx-In for guile-devel@gnu.org; Wed, 01 Mar 2017 15:35:12 -0500 Original-Received: from relay4-d.mail.gandi.net ([217.70.183.196]:55325) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cjAxo-0006P7-Cb for guile-devel@gnu.org; Wed, 01 Mar 2017 15:35:08 -0500 Original-Received: from [IPv6:2a01:e35:2ef3:d930:1cb1:4034:54ae:968f] (unknown [IPv6:2a01:e35:2ef3:d930:1cb1:4034:54ae:968f]) (Authenticated sender: amirouche@hypermove.net) by relay4-d.mail.gandi.net (Postfix) with ESMTPSA id 2B5AB1720F7 for ; Wed, 1 Mar 2017 21:34:57 +0100 (CET) In-Reply-To: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 217.70.183.196 X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Developers list for Guile, the GNU extensibility library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Original-Sender: "guile-devel" Xref: news.gmane.org gmane.lisp.guile.devel:18972 Archived-At: 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