mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-05-22 12:30:32 +02:00
http-read calls setvbuf only once
* module/web/server/http.scm (http-read): Don't play the setvbuf dance, it was throwing away buffered input. Instead just call setvbuf once before doing any reads or writes.
This commit is contained in:
parent
e9634465e3
commit
4595600a08
1 changed files with 2 additions and 6 deletions
|
@ -90,8 +90,8 @@
|
||||||
;;
|
;;
|
||||||
;; FIXME: preserve meta-info.
|
;; FIXME: preserve meta-info.
|
||||||
(let ((client (accept (poll-set-port poll-set idx))))
|
(let ((client (accept (poll-set-port poll-set idx))))
|
||||||
;; Set line buffering while reading the request.
|
;; Buffer input and output on this port.
|
||||||
(setvbuf (car client) _IOLBF)
|
(setvbuf (car client) _IOFBF)
|
||||||
;; From "HOP, A Fast Server for the Diffuse Web", Serrano.
|
;; From "HOP, A Fast Server for the Diffuse Web", Serrano.
|
||||||
(setsockopt (car client) SOL_SOCKET SO_SNDBUF (* 12 1024))
|
(setsockopt (car client) SOL_SOCKET SO_SNDBUF (* 12 1024))
|
||||||
(poll-set-add! poll-set (car client) *events*)
|
(poll-set-add! poll-set (car client) *events*)
|
||||||
|
@ -117,8 +117,6 @@
|
||||||
#t
|
#t
|
||||||
(lambda ()
|
(lambda ()
|
||||||
(let ((req (read-request port)))
|
(let ((req (read-request port)))
|
||||||
;; Block buffering for reading body and writing response.
|
|
||||||
(setvbuf port _IOFBF)
|
|
||||||
(values port
|
(values port
|
||||||
req
|
req
|
||||||
(read-request-body/bytevector req))))
|
(read-request-body/bytevector req))))
|
||||||
|
@ -151,8 +149,6 @@
|
||||||
(cond
|
(cond
|
||||||
((keep-alive? response)
|
((keep-alive? response)
|
||||||
(force-output port)
|
(force-output port)
|
||||||
;; back to line buffered
|
|
||||||
(setvbuf port _IOLBF)
|
|
||||||
(poll-set-add! (http-poll-set server) port *events*))
|
(poll-set-add! (http-poll-set server) port *events*))
|
||||||
(else
|
(else
|
||||||
(close-port port)))
|
(close-port port)))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue