Fixes PR11024.

The problem was that when the connection is closed its custodian is shutdown, thus killing the thread that was going to bring the server down. The difference between curl and the browser was that even though they both use HTTP/1.1, the browser actually leaves the connection open longer.
This commit is contained in:
Jay McCarthy 2010-07-15 10:14:16 -06:00
parent 334978a8e4
commit 80b6ceeff1
2 changed files with 3 additions and 1 deletions

View File

@ -130,5 +130,7 @@
(shutdown-server))])
(with-handlers ([exn:break? (lambda (exn) (bye))])
(semaphore-wait/enable-break sema)
; Give the final response time to get there
(sleep 2)
;; We can get here if a /quit url is visited
(bye))))

View File

@ -25,7 +25,7 @@
(define (quit-server sema)
(lift:make
(lambda (request)
(thread (lambda () (sleep 2) (semaphore-post sema)))
(semaphore-post sema)
`(html (head (title "Server Stopped")
(link ([rel "stylesheet"] [href "/error.css"])))
(body (div ([class "section"])