eschulte pushed a commit to branch master
in repository elpa.
commit 5f7ef628440630c73a3f903899f56e5731b22f43
Author: Eric Schulte <[email protected]>
Date: Sat Feb 8 12:29:35 2014 -0700
set Content-length when serving files
---
web-server.el | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/web-server.el b/web-server.el
index 7e713e9..5c6e758 100644
--- a/web-server.el
+++ b/web-server.el
@@ -547,10 +547,12 @@ Optionally explicitly set MIME-TYPE, otherwise it is
guessed by
(let ((mime (or mime-type
(mm-default-file-encoding path)
"application/octet-stream")))
- (ws-response-header proc 200 (cons "Content-type" mime))
(process-send-string proc
(with-temp-buffer
(insert-file-contents-literally path)
+ (ws-response-header proc 200
+ (cons "Content-type" mime)
+ (cons "Content-length" (- (point-max) (point-min))))
(buffer-string)))))
(defun ws-send-directory-list (proc directory &optional match)