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: Re: Serving files with guile web server Date: Sat, 19 Mar 2011 18:23:33 -0400 (EDT) Message-ID: <1091.189.215.48.232.1300573413.squirrel@lavabit.com> References: <9838.187.147.43.113.1300318403.squirrel@lavabit.com> <58164.187.147.43.113.1300373729.squirrel@lavabit.com> <874o6z97gg.fsf@ossau.uklinux.net> <18101.189.215.48.232.1300553233.squirrel@lavabit.com> <87aagrrn43.fsf@ossau.uklinux.net> 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 1300573434 3486 80.91.229.12 (19 Mar 2011 22:23:54 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sat, 19 Mar 2011 22:23:54 +0000 (UTC) Cc: guile-user@gnu.org To: "Neil Jerram" Original-X-From: guile-user-bounces+guile-user=m.gmane.org@gnu.org Sat Mar 19 23:23:50 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 1Q14Yn-0003mF-1E for guile-user@m.gmane.org; Sat, 19 Mar 2011 23:23:49 +0100 Original-Received: from localhost ([127.0.0.1]:40629 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Q14Ym-0005OC-CV for guile-user@m.gmane.org; Sat, 19 Mar 2011 18:23:48 -0400 Original-Received: from [140.186.70.92] (port=49990 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Q14Yi-0005Nu-46 for guile-user@gnu.org; Sat, 19 Mar 2011 18:23:45 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Q14Yg-0007zN-Rd for guile-user@gnu.org; Sat, 19 Mar 2011 18:23:44 -0400 Original-Received: from karen.lavabit.com ([72.249.41.33]:60683) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Q14Yg-0007zF-Jk for guile-user@gnu.org; Sat, 19 Mar 2011 18:23:42 -0400 Original-Received: from a.earth.lavabit.com (a.earth.lavabit.com [192.168.111.10]) by karen.lavabit.com (Postfix) with ESMTP id 9394811B937; Sat, 19 Mar 2011 17:23:38 -0500 (CDT) Original-Received: from lavabit.com (189.215.48.232.cable.dyn.cableonline.com.mx [189.215.48.232]) by lavabit.com with ESMTP id FXLDFCK1NAH6; Sat, 19 Mar 2011 17:23:33 -0500 Original-Received: from 189.215.48.232 (SquirrelMail authenticated user romel) by lavabit.com with HTTP; Sat, 19 Mar 2011 18:23:33 -0400 (EDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=lavabit; d=lavabit.com; b=C/LOMSkcw9m5BdB7PgJNdfsXzVqtMZNxKZhSj7MQjlN7rjR9IlXDGjigdNec2yVFRvOiW/nQ7vsnsFqMIiO1AxspsRaCXWBJu7y4Z8kOS3dlE6eV9QLH2QH5sL+xGK14I1KY8NMPX8IhujVbr/FxTiFN9DqapX5WMl/1NKI57pk=; h=Message-ID:In-Reply-To:References:Date:Subject:From:To:Cc:User-Agent:MIME-Version:Content-Type:Content-Transfer-Encoding; In-Reply-To: <87aagrrn43.fsf@ossau.uklinux.net> 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:8547 Archived-At: Neil Jerram writes: > Certainly, it looks good. Where does mime-type-ref come from, though? > Thanks, mime-type-ref comes from (glider mime-types) it's a little module I wrote specifically for this purpose, see code below (define-module (glider mime-types) :export (mime-type-ref text-mime-type? mime-type-symbol)) (define *mime-types* (make-hash-table 31)) (hash-set! *mime-types* "css" '("text" . "css")) (hash-set! *mime-types* "txt" '("text" . "plain")) (hash-set! *mime-types* "png" '("image" . "png")) (hash-set! *mime-types* "jpg" '("image" . "jpeg")) (hash-set! *mime-types* "jpeg" '("image" . "jpeg")) (hash-set! *mime-types* "gif" '("image" . "gif")) (define (mime-type-ref file-name) (let* ((dot-position (string-rindex file-name #\.)) (extension (and dot-position (string-copy file-name (+ dot-position 1)))) (mime-type (and dot-position (hash-ref *mime-types* extension)))) (if mime-type mime-type '("application" . "octet-stream")))) (define (mime-type-symbol mime-type) (string->symbol (string-append (car mime-type) "/" (cdr mime-type)))) (define (text-mime-type? mime-type) (if (equal? (car mime-type) "text") #t #f)) > Perhaps that could be wrapped up as `static-file-response' (or a better > name if you can think of one) and added to (web server). It would be great to have static file serving available from (web server)= , I think that static-file-response is a good name. Thanks, Romel Sandoval