[racket] [plt-scheme] Faster CGI

From: Matt Gushee (matt at gushee.net)
Date: Wed Nov 19 06:11:12 EST 2014

Looks promising. Thank you!

On Wed, Nov 19, 2014 at 3:14 AM, Stephen De Gabrielle
<spdegabrielle at gmail.com> wrote:
> Google the original thread for more
> Note racket has changed significantly since 2008!
> ---------- Forwarded message ---------
> From: Eddie Sullivan <eddieSull at hotmail.com>
> Date: Wed, 10 Dec 2008 at 19:45
> Subject: Re: [plt-scheme] Faster CGI
> To: <plt-scheme at list.cs.brown.edu>
> If anybody's interested, I've attached a simple wrapper for the FastCGI C
> library I hacked up when I was first learning Scheme. As a warning, it's
> probably not the best written code, and it's definitely incomplete, but it
> may be a starting point.
> I originally wanted to code up the FastCGI protocol from scratch, but the
> networking libraries provided with PLT are not low-level enough (I needed
> some way to determine what type of port stdin was, to differentiate between
> CGI and FCGI).
> Anyway, you should be able to run the same code under FastCGI and regular
> CGI. The function "fcgi-loop" takes a no-parameter-function as parameter,
> and calls it repeatedly (for FCGI) or once (for CGI). In the case of FCGI,
> current-input-port, current-output-port, and current-error-port are
> parameterized for the FCGI versions of those ports. It also tries to fake
> out the environment variables, but that part's a little hacky.
> The attached fcgi-cgi.scm shows an example use. It's a (F)CGI script that
> multiplies the two request parameters num1 and num2.
> Hope it helps.
> -Eddie Sullivan
>> From: "Jay McCarthy" <jay.mccarthy at gmail.com>
>> Subject: Re: [plt-scheme] Faster CGI
>> Ah, I understand now. Yes, I would recommend writing something like a
>> FastCGI wrapper, I imagine that the protocol is fairly simple, if
>> you'd like me to look it over and give any tips on controlling
>> resources (i.e., with custodians), I'd be happy to.
>> Jay
>> On Mon, Dec 8, 2008 at 8:27 PM, Henk Boom <lunarc.lists at gmail.com> wrote:
>> > 2008/12/8 Shriram Krishnamurthi <sk at cs.brown.edu>:
>> >> Yes, that's correct.  But the point is that they make it much more
>> >> friendly to use continuations if you so desire (ie, if you haven't
>> >> used the server w/ continuations in a year or two, you may want to
>> >> check whether these additions pass your necessary benchmarking).
>> >
>> > Ok, I see that point. If I am going to use the PLT Web Server then it
>> > makes sense to investigate those options to make using continuations
>> > affordable. The problem I was running into, though, was unaffordable
>> > memory usage even in the absence of continuations.
>> >
>> >    Henk
>> >
>> _________________________________________________
>   For list-related administrative tasks:
>   http://list.cs.brown.edu/mailman/listinfo/plt-scheme

Posted on the users mailing list.