From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: romel@lavabit.com Newsgroups: gmane.lisp.guile.user Subject: Serving files with guile web server Date: Wed, 16 Mar 2011 19:33:23 -0400 (EDT) Message-ID: <9838.187.147.43.113.1300318403.squirrel@lavabit.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain;charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: dough.gmane.org 1300318446 19169 80.91.229.12 (16 Mar 2011 23:34:06 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Wed, 16 Mar 2011 23:34:06 +0000 (UTC) To: guile-user@gnu.org Original-X-From: guile-user-bounces+guile-user=m.gmane.org@gnu.org Thu Mar 17 00:34:01 2011 Return-path: Envelope-to: guile-user@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Q00E5-0004Y1-0V for guile-user@m.gmane.org; Thu, 17 Mar 2011 00:34:01 +0100 Original-Received: from localhost ([127.0.0.1]:48185 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Q00Dl-0005Jg-Ga for guile-user@m.gmane.org; Wed, 16 Mar 2011 19:33:41 -0400 Original-Received: from [140.186.70.92] (port=35523 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Q00Db-0005Ja-4P for guile-user@gnu.org; Wed, 16 Mar 2011 19:33:32 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Q00DZ-0007Xr-Uo for guile-user@gnu.org; Wed, 16 Mar 2011 19:33:30 -0400 Original-Received: from karen.lavabit.com ([72.249.41.33]:44407) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Q00DZ-0007Xb-Rr for guile-user@gnu.org; Wed, 16 Mar 2011 19:33:29 -0400 Original-Received: from a.earth.lavabit.com (a.earth.lavabit.com [192.168.111.10]) by karen.lavabit.com (Postfix) with ESMTP id 6A80111B8AE for ; Wed, 16 Mar 2011 18:33:28 -0500 (CDT) Original-Received: from lavabit.com (dsl-187-147-43-113-dyn.prod-infinitum.com.mx [187.147.43.113]) by lavabit.com with ESMTP id 802DGTFPVAIQ for ; Wed, 16 Mar 2011 18:33:23 -0500 Original-Received: from 187.147.43.113 (SquirrelMail authenticated user romel) by lavabit.com with HTTP; Wed, 16 Mar 2011 19:33:23 -0400 (EDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=lavabit; d=lavabit.com; b=YN7xWQhuHQIC7UrX6CGsAqTT89vQmxoj69096cftpFjIbIimU41wtTpTxbDT3T2i1x5avTabMYCK6DeGM/6nKUccEe6mR5XeqiXds2ekXXsCPnvhteALMbVhG1X87/Zjc4FYNq1FzCZfNBq9xc8cC9Vspv8+Y107ivHDyVtnykc=; h=Message-ID:Date:Subject:From:To:User-Agent:MIME-Version:Content-Type:Content-Transfer-Encoding; User-Agent: SquirrelMail/1.4.13 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-Received-From: 72.249.41.33 X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: guile-user-bounces+guile-user=m.gmane.org@gnu.org Errors-To: guile-user-bounces+guile-user=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.user:8541 Archived-At: Hi, I will like to serve plain text files and images with run-server from (we= b server) module. After reading the documentation I think in something similar to: ----------------- (define (serve-file request body) (let* ((path (request-path-components request)) (file-path (public-file-path path))) (if (and file-path (file-exists? file-path)) (values '((content-type . (text/plain))) (open-input-file file-path)) (not-found request)))) (define (file-server) (run-server serve-file)) ----------------- But I got: ----------------- ERROR: In procedure scm-error: ERROR: unexpected body type Entering a new prompt. Type `,bt' for a backtrace or `,q' to continue. scheme@(guile-user) [1]> ,bt In module/web/server.scm: 291:29 1 (#) In unknown file: 0 (scm-error misc-error #f "~A" ("unexpected body type") #f) ----------------- Anybody knows how to serve text and image files from guile web server? Thanks, Romel Sandoval