unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
* Serving files with guile web server
@ 2011-03-16 23:33 romel
  2011-03-17 14:55 ` romel
  0 siblings, 1 reply; 10+ messages in thread
From: romel @ 2011-03-16 23:33 UTC (permalink / raw)
  To: guile-user

Hi,

I will like to serve plain text files and images with run-server from (web
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 (#<procedure 22d9480 at module/web/server.scm:283:3 ()>)
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






^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2011-03-31 15:09 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-03-16 23:33 Serving files with guile web server romel
2011-03-17 14:55 ` romel
2011-03-19  2:20   ` Neil Jerram
2011-03-19 16:47     ` romel
2011-03-19 18:17       ` Neil Jerram
2011-03-19 22:23         ` romel
2011-03-31 14:44       ` Andy Wingo
2011-03-22  8:51     ` Thien-Thi Nguyen
2011-03-31 14:23       ` Andy Wingo
2011-03-31 15:09         ` Andy Wingo

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).