mirror of
https://github.com/servo/servo.git
synced 2025-06-24 00:54:32 +01:00
Cherry-pick a wptserve change to support Content-Type in .headers files.
This commit is contained in:
parent
1ed3521dcf
commit
b15c55e407
1 changed files with 6 additions and 6 deletions
|
@ -147,9 +147,12 @@ class FileHandler(object):
|
|||
raise HTTPException(404)
|
||||
|
||||
def get_headers(self, request, path):
|
||||
rv = self.default_headers(path)
|
||||
rv.extend(self.load_headers(request, os.path.join(os.path.split(path)[0], "__dir__")))
|
||||
rv.extend(self.load_headers(request, path))
|
||||
rv = (self.load_headers(request, os.path.join(os.path.split(path)[0], "__dir__")) +
|
||||
self.load_headers(request, path))
|
||||
|
||||
if not any(key.lower() == "content-type" for (key, _) in rv):
|
||||
rv.insert(0, ("Content-Type", guess_content_type(path)))
|
||||
|
||||
return rv
|
||||
|
||||
def load_headers(self, request, path):
|
||||
|
@ -206,9 +209,6 @@ class FileHandler(object):
|
|||
f.seek(byte_range.lower)
|
||||
return f.read(byte_range.upper - byte_range.lower)
|
||||
|
||||
def default_headers(self, path):
|
||||
return [("Content-Type", guess_content_type(path))]
|
||||
|
||||
|
||||
file_handler = FileHandler()
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue