Hello,

I've been working on a Fast CGI [1] library for Ikarus (and other R6
compliant schemes?) in my spare time, and today I served my first
successful request! :)

(define (responder-test flags params stdin stdout stderr)
  (let* ([utf8 (make-transcoder 'utf-8-codec)]
         [writer  (transcoded-port stdout utf8)])
    (put-string writer "Content-Type: text/html\r\n\r\n<html>HELLO
WORLD</html>\r\n")
    0))

It's not much at the moment, and the stdout and stderr ports are
pretty broken, and that brings me to my questions.

I'm currently using make-custom-binary-output-port to create ports for
stdout and stderr and because I want to support multiplexed
connections over the fcgi connection the port has its own buffer that
it writes to, when a threshold is reached (or close is called) it's
written to the socket, but I would also like detect when
"flush-output-buffer" is called, so I can force the buffered data to
be written to the fcgi connection.

The R6RS spec mentions buffer-modes on ports, and says that each port
has one of three buffer modes: "none", "line" , "block", and it
mentions how to check the buffer mode on a port, but I can't see any
mention on how to set it, and also, if you can set it, can I implement
my own custom buffer mode, or would I have to set it to "none" and
implement the buffering in the port? Or can you change the properties
of the "block" buffer mode on a per port basis?

But the port returned by make-custom-binary-output-port has buffer
mode "block". Which means that when I call flush-output-port on
stdout, all I get is whatever data the port buffer has buffered, and
not an indication that "flush" was called. I was hoping that with
buffer-mode "none" I could detect a "flush" as a zero byte write and
write whatever I have in my buffer to the socket, but that might be
wishful thinking, maybe there's an easier way to accomplish what I
want?


Happy new year everyone!

/Patrik

[1] http://www.fastcgi.com

Reply via email to