From eb4ea212bf6a1b0d0e81388b66a9fa1d4b67358c Mon Sep 17 00:00:00 2001 From: Drew Crampsie Date: Wed, 15 Jan 2025 00:33:19 +0000 Subject: [PATCH] Fix gxhttpd bug: No content length when chunking --- src/tools/gxhttpd.ss | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/tools/gxhttpd.ss b/src/tools/gxhttpd.ss index ef35ab50e..2de61567c 100644 --- a/src/tools/gxhttpd.ss +++ b/src/tools/gxhttpd.ss @@ -478,11 +478,11 @@ => :procedure (let* ((content-type (path-extension->mime-type-name path)) (headers - [(if content-type + [["Content-Length" :: (number->string (file-info-size info))] + (if content-type ["Content-Type" :: content-type] ["Content-Type" :: "application/octet-stream"]) - ["Last-Modified" :: (number->string (exact (floor (time->seconds (file-info-last-modification-time info)))))] - ["Content-Length" :: (number->string (file-info-size info))]])) + ["Last-Modified" :: (number->string (exact (floor (time->seconds (file-info-last-modification-time info)))))]])) (if (fx<= (file-info-size info) max-file-cache-size) ;; cache the content @@ -501,12 +501,13 @@ (using (req :- http-request) (case req.method ((GET) - (http-response-file res headers path)) + (http-response-file res (cdr headers) path)) ((HEAD) (http-response-write res 200 headers #f)) (else (http-response-write-condition res Forbidden)))))))) + (def (find-handler tab server-path) (let loop ((path server-path)) (cond