Ticket #188 (closed enhancement)

Opened 15 years ago

Last modified 15 years ago

Not a ticket for this component, but the request enhancement for the web server

Reported by: anonymous Owned by: jaymccarthy
Priority: minor Milestone:
Component: untyped/dispatch.plt Keywords: web server response incremental comet
Cc: Version: (2 1)
Racket Version: 4.2

Description

Hello! Sorry for this 'transit-request' post.
Please move following enhancement ticket to the web server team.

The current make-response/incremental (in response.ss) has two
disadvantages: 1st can lead to browser-confusing chunked response
with zero chunk lengths, and the 2nd freezes the Comet (javascript
technology) programming - there is no way to flush out selected
chunks during paused response/incremental (with sleeps).

Please consider following patch, which should eliminate both issues. It interprets zero-length chunk simply as `flush-output' request for previous chunks. Comet now runs well using
'(do-loop (wait-and-send-next-event) (send/bytes #""))' pattern.

--- collects/web-server/http/response.ss.orig 2009-06-05 10:40:07.747989122 +0400

+++ collects/web-server/http/response.ss 2009-06-05 10:57:55.674988779 +0400
@@ -110,10 +110,13 @@

(begin

((response/incremental-generator bresp)

(lambda chunks

- (fprintf o-port "~x\r\n"
- (apply + 0 (map bytes-length chunks)))
+ (let ((len (apply + 0 (map bytes-length chunks))))
+ (if (= 0 len) ; Protects against zero-length-chunk bug
+ (flush-output o-port) ; ... and makes Comet happy
+ (begin
+ (fprintf o-port "~x\r\n" len)

(for-each (lambda (chunk) (display chunk o-port)) chunks)

- (fprintf o-port "\r\n")))
+ (fprintf o-port "\r\n"))))))

; one \r\n ends the last (empty) chunk and the second \r\n ends the (non-existant) trailers
(fprintf o-port "0\r\n\r\n")))]))

Change History

Changed 15 years ago by jaymccarthy

  • owner changed from untyped to jaymccarthy
  • status changed from new to closed

This is fixed in SVN 15092.

Note: See TracTickets for help on using tickets.