mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Content server: On second thoughts dont honor If-Modified-Since as it will lead to hard to replicate conditions
This commit is contained in:
parent
9fe0080692
commit
4cb1907a13
@ -8,7 +8,6 @@ __docformat__ = 'restructuredtext en'
|
|||||||
import re, os, posixpath
|
import re, os, posixpath
|
||||||
|
|
||||||
import cherrypy
|
import cherrypy
|
||||||
from cherrypy.lib import cptools
|
|
||||||
|
|
||||||
from calibre import fit_image, guess_type
|
from calibre import fit_image, guess_type
|
||||||
from calibre.utils.date import fromtimestamp
|
from calibre.utils.date import fromtimestamp
|
||||||
@ -201,11 +200,10 @@ class ContentServer(object):
|
|||||||
fm = self.db.format_metadata(id, format, allow_cache=False)
|
fm = self.db.format_metadata(id, format, allow_cache=False)
|
||||||
if not fm:
|
if not fm:
|
||||||
raise cherrypy.HTTPError(404, 'book: %d does not have format: %s'%(id, format))
|
raise cherrypy.HTTPError(404, 'book: %d does not have format: %s'%(id, format))
|
||||||
|
mi = newmi = self.db.get_metadata(id, index_is_id=True)
|
||||||
|
|
||||||
cherrypy.response.headers['Last-Modified'] = \
|
cherrypy.response.headers['Last-Modified'] = \
|
||||||
self.last_modified(fm['mtime'])
|
self.last_modified(max(fm['mtime'], mi.last_modified))
|
||||||
# Check the If-Modified-Since request header. Returns appropriate HTTP
|
|
||||||
# response
|
|
||||||
cptools.validate_since()
|
|
||||||
|
|
||||||
fmt = self.db.format(id, format, index_is_id=True, as_file=True,
|
fmt = self.db.format(id, format, index_is_id=True, as_file=True,
|
||||||
mode='rb')
|
mode='rb')
|
||||||
@ -216,7 +214,6 @@ class ContentServer(object):
|
|||||||
mt = 'application/octet-stream'
|
mt = 'application/octet-stream'
|
||||||
cherrypy.response.headers['Content-Type'] = mt
|
cherrypy.response.headers['Content-Type'] = mt
|
||||||
|
|
||||||
mi = newmi = self.db.get_metadata(id, index_is_id=True)
|
|
||||||
if format == 'EPUB':
|
if format == 'EPUB':
|
||||||
# Get the original metadata
|
# Get the original metadata
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user