[plt-scheme] Buffering problems with web-server and HTTP/1.1

From: Edmund Dengler (edmundd at eSentire.com)
Date: Sat May 21 22:07:52 EDT 2005

Greetings!

Using the current CVS tree, I am having problems with the web server
buffering output under HTTP/1.1 requests, so a browser does not get a
response.

I found a fast fix by specifying no buffering on the output port within
<web-server-unit.ss>:

      (define (server-loop get-ports)
        (let loop ()
          (let ([connection-cust (make-custodian)])
            (parameterize ([current-custodian connection-cust])
              (let-values ([(ip op) (get-ports)])
                (file-stream-buffer-mode op 'none) ;; FIX
                (thread
                 (lambda ()
                   (serve-connection
                    (new-connection config:initial-connection-timeout
                                    ip op (current-custodian) #f))))))
            (loop))))

(Note: This problem does not occur under 299.100)

Can anyone let me know if this is a resonable fix, or if there is a better
spot?

Regards!
Ed



Posted on the users mailing list.