[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)
- [elpa] 93/119: helper function to serve directory listings, (continued)
- [elpa] 93/119: helper function to serve directory listings, Eric Schulte, 2014/03/10
- [elpa] 90/119: tutorials, Eric Schulte, 2014/03/10
- [elpa] 88/119: accept single-function handlers, Eric Schulte, 2014/03/10
- [elpa] 96/119: expand this example w/smart dir listings, Eric Schulte, 2014/03/10
- [elpa] 98/119: TODO chunked encoding, Eric Schulte, 2014/03/10
- [elpa] 99/119: serve files with htmlize Emacs fontification, Eric Schulte, 2014/03/10
- [elpa] 97/119: added ws-stop-all convenience function, Eric Schulte, 2014/03/10
- [elpa] 89/119: authorization helper, Eric Schulte, 2014/03/10
- [elpa] 92/119: simpler handler in example, Eric Schulte, 2014/03/10
- [elpa] 102/119: updated content- transfer-encoding notes, Eric Schulte, 2014/03/10
- [elpa] 103/119: set Content-length when serving files,
Eric Schulte <=
- [elpa] 95/119: better ws-send-directory-list, Eric Schulte, 2014/03/10
- [elpa] 106/119: TODO Content and Transfer encodings, Eric Schulte, 2014/03/10
- [elpa] 104/119: tweak notes, Eric Schulte, 2014/03/10
- [elpa] 108/119: test chunked/gzipped transfer/content encodings, Eric Schulte, 2014/03/10
- [elpa] 100/119: manual application of x-gzip content encoding, Eric Schulte, 2014/03/10
- [elpa] 101/119: manual application of chunked transfer encoding, Eric Schulte, 2014/03/10
- [elpa] 107/119: support for content and transfer encodings, Eric Schulte, 2014/03/10
- [elpa] 109/119: doc for new content/transfer encoding helpers, Eric Schulte, 2014/03/10
- [elpa] 110/119: automatically generate dir file w/install-info, Eric Schulte, 2014/03/10
- [elpa] 113/119: Fix WebSocket varint length encoding, Eric Schulte, 2014/03/10