emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] 103/119: set Content-length when serving files


From: Eric Schulte
Subject: [elpa] 103/119: set Content-length when serving files
Date: Mon, 10 Mar 2014 16:57:54 +0000

eschulte pushed a commit to branch master
in repository elpa.

commit 5f7ef628440630c73a3f903899f56e5731b22f43
Author: Eric Schulte <address@hidden>
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)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]