Commit e94938eb authored by Las Zenow's avatar Las Zenow

Add Content-Length and Last-Modified headers to downloads

- Closes: #47
parent a8ac4494
package trantor
import (
"time"
log "github.com/cihub/seelog"
"fmt"
......@@ -116,6 +118,8 @@ func downloadHandler(h handler) {
headers := h.w.Header()
headers["Content-Type"] = []string{"application/epub+zip"}
headers["Content-Disposition"] = []string{"attachment; filename=\"" + book.Title + ".epub\""}
headers["Content-Length"] = []string{fmt.Sprint(book.FileSize)}
headers["Last-Modified"] = []string{fmt.Sprint(book.UploadDate.Format(time.RFC1123))}
addCacheControlHeader(h.w, false)
io.Copy(h.w, f)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment