mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-16 16:50:21 +02:00
Web client+server: Add Content-Length header for empty bodies.
* module/web/client.scm (sanitize-request): Add a Content-Length header if a body if given, even if the body is empty. * module/web/server.scm (sanitize-response): Add a Content-Length header if a body if given, even if the body is empty.
This commit is contained in:
parent
361553b49d
commit
3b2226ec91
2 changed files with 4 additions and 2 deletions
|
@ -139,6 +139,9 @@ as is the case by default with a request returned by `build-request'."
|
|||
((not body)
|
||||
(let ((length (request-content-length request)))
|
||||
(if length
|
||||
;; FIXME make this stricter: content-length header should be
|
||||
;; prohibited if there's no body, even if the content-length
|
||||
;; is 0.
|
||||
(unless (zero? length)
|
||||
(error "content-length, but no body"))
|
||||
(when (assq 'transfer-encoding (request-headers request))
|
||||
|
@ -174,7 +177,6 @@ as is the case by default with a request returned by `build-request'."
|
|||
(rlen (if (= rlen blen)
|
||||
request
|
||||
(error "bad content-length" rlen blen)))
|
||||
((zero? blen) request)
|
||||
(else (extend-request request 'content-length blen))))
|
||||
body))))
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue