[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
cgi.ss, fastcgi.scm, and environment variables
Dear all,
I'm using fastcgi.ss in conjunction with some of the libraries
in the `net' collection (cgi for instance). And I noticed a problem
with `getenv', which is used in `get-bindings/get':
,--------------------
| (define get-bindings/get
| (lambda ()
| (let ((p (open-input-string
| (getenv "QUERY_STRING"))))
| ...
`--------------------
because "QUERY_STRING" is defined but in the request environment
returned by some of the fastcgi procedures, say
`fcgi:accept-request-as-responder'. So I ended up doing something
like:
,--------------------
| (define request-environment (make-parameter '()))
|
| (define request-getenv
| (lambda (name)
| (let ((p (assoc name (request-environment))))
| (and p (cdr p)))))
|
| ...
|
| (putenv "QUERY_STRING" (request-getenv "QUERY_STRING"))
| ...
`--------------------
from here on `get-bindings/get' works just fine, since it finds
QUERY_STRING on the environment. Is this the Right Way(TM) of solving
the problem? It works for me, but I feel it's awkward.
And if I would've wanted to use `get-bindings' then I
should have `putenv'ed not only QUERY_STRING but also REQUEST_METHOD.
How are you guys solving this? Or isn't anybody else using
both: fastcgi and cgi libraries? :-)
TIA,
Francisco