unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
From: Zelphir Kaltstahl <zelphirkaltstahl@posteo.de>
To: Ricardo Wurmus <rekado@elephly.net>
Cc: guile-user@gnu.org
Subject: Re: Web development
Date: Fri, 4 Sep 2020 22:09:52 +0200	[thread overview]
Message-ID: <28851dc6-d0a2-4b17-cf0c-c14571f02110@posteo.de> (raw)
In-Reply-To: <874kodfq4h.fsf@elephly.net>

Hi Ricardo!

On 9/4/20 6:44 PM, Ricardo Wurmus wrote:
> Zelphir Kaltstahl <zelphirkaltstahl@posteo.de> writes:
>
>> So I have a few questions:
>>
>> (1) How do you do your Guile web development? What's the setup?
> I don’t use a framework in my web projects; just the included web
> modules and sometimes the fibers web server.  I keep everything
> stateless so that I can spin up many workers (i.e. Guile processes
> with a web server listening on one of a range of local ports) and
> dispatch to them from a reverse proxy such as Nginx or Lighttpd.
>
>> (2) What do you use to serve static files (securely)? If you use Guile's
>> web server, how exactly do you do it? Do you have the code somewhere?
> I configure an assets directory and define a procedure that sanitizes
> the requested file name to serve it from that directory.  I don’t do
> much with files so I don’t usually do anything other than
>
>     (call-with-input-file file-name get-bytevector-all)
>
> for the body of the response.  But if I had to send large files I’d use
> “sendfile” directly.

Don't you need to also check what kind of file type it is and select the
appropriate MIME type for answering the request? (Do you have some code
public somewhere, showing how to do this?)

And how do you use sendfile directly? (Code example for this would also
be great to see.)

(I've checked https://github.com/rekado and https://git.elephly.net/,
but could not find a web server project.)

Is it still necessary to sanitize the requested file names, when an HTTP
server handles requests for assets before the Guile application is hit?


>> (3) Perhaps there is a minimalistic option instead of NGINX or HAProxy
>> out there, which is also free software? Is there perhaps even anything
>> in Guile, which I could use, that is suitable for serving static files?
> Lighttpd seems to be lighter than Nginx.  If all you want is serve
> static files upon request I’d use just Guile, matching on the request,
> looking up the file in a declared directory, and using sendfile to push
> it to the requester.


Best regards,
Zelphir




  reply	other threads:[~2020-09-04 20:09 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-04 15:43 Web development Zelphir Kaltstahl
2020-09-04 15:56 ` [EXT] " Thompson, David
2020-09-04 20:55   ` Zelphir Kaltstahl
2020-09-05  6:29     ` Joshua Branson via General Guile related discussions
2020-09-04 16:44 ` Ricardo Wurmus
2020-09-04 20:09   ` Zelphir Kaltstahl [this message]
2020-09-04 20:25     ` Ricardo Wurmus
  -- strict thread matches above, loose matches on Subject: below --
2020-09-07  9:35 tantalum
2020-09-07 19:53 ` Zelphir Kaltstahl
2019-10-20  6:10 Diversification [ branched from Re: conflicts in the gnu project now affect guile] Todor Kondić
2019-10-20  6:14 ` John Cowan
2019-10-23  6:16   ` Amirouche Boubekki
2019-10-23  6:48     ` pelzflorian (Florian Pelz)
2019-10-23 10:37       ` Chris Vine
2019-10-23 11:25         ` pelzflorian (Florian Pelz)
2019-10-23 12:33           ` pelzflorian (Florian Pelz)
2019-10-23 19:19             ` Zelphir Kaltstahl
2020-09-05  6:15               ` Joshua Branson via General Guile related discussions
2020-09-05 11:50                 ` Web development Zelphir Kaltstahl
2020-09-05 13:09                   ` Ricardo Wurmus

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=28851dc6-d0a2-4b17-cf0c-c14571f02110@posteo.de \
    --to=zelphirkaltstahl@posteo.de \
    --cc=guile-user@gnu.org \
    --cc=rekado@elephly.net \
    /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).