diff --git a/src/calibre/srv/respond.py b/src/calibre/srv/respond.py index a5356f0d32..de02abbc06 100644 --- a/src/calibre/srv/respond.py +++ b/src/calibre/srv/respond.py @@ -97,7 +97,7 @@ class DynamicOutput(object): ct = outheaders.get('Content-Type', 'text/plain') if 'charset=' not in ct: ct += '; charset=UTF-8' - outheaders.set('Content-Type', ct, replace=True) + outheaders.set('Content-Type', ct, replace_all=True) self.content_length = len(self.data) self.etag = None self.accept_ranges = False @@ -173,16 +173,16 @@ def finalize_output(output, inheaders, outheaders, status_code, is_http1, method # TODO: Ranges, If-Range if output.etag and method in ('GET', 'HEAD'): - outheaders.set('ETag', output.etag, replace=True) + outheaders.set('ETag', output.etag, replace_all=True) if accept_ranges: - outheaders.set('Accept-Ranges', 'bytes', replace=True) + outheaders.set('Accept-Ranges', 'bytes', replace_all=True) elif compressible: - outheaders.set('Content-Encoding', 'gzip', replace=True) + outheaders.set('Content-Encoding', 'gzip', replace_all=True) if output.content_length is not None and not compressible and not ranges: - outheaders.set('Content-Length', '%d' % output.content_length, replace=True) + outheaders.set('Content-Length', '%d' % output.content_length, replace_all=True) if compressible or output.content_length is None: - outheaders.set('Transfer-Encoding', 'chunked', replace=True) + outheaders.set('Transfer-Encoding', 'chunked', replace_all=True) output.commit = output.write_compressed if compressible else output.write diff --git a/src/calibre/srv/utils.py b/src/calibre/srv/utils.py index 1a13c43d6d..7537e3f88c 100644 --- a/src/calibre/srv/utils.py +++ b/src/calibre/srv/utils.py @@ -53,8 +53,8 @@ class MultiDict(dict): # {{{ yield v[-1] itervalues = values - def set(self, key, val, replace=False): - if replace: + def set(self, key, val, replace_all=False): + if replace_all: dict.__setitem__(self, key, [val]) else: self[key] = val