From 4478b4f578ec570a6424137a440604dc9b05dcbb Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Tue, 3 Dec 2019 22:08:20 +0000 Subject: [PATCH] head file types --- daemon.py | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/daemon.py b/daemon.py index df18234a4..25393d508 100644 --- a/daemon.py +++ b/daemon.py @@ -3453,7 +3453,31 @@ class PubServer(BaseHTTPRequestHandler): self._benchmarkGETtimings(GETstartTime,GETtimings,55) def do_HEAD(self): - self._set_headers('application/json',0,None) + if self.path.endswith('.png'): + self._set_headers('image/png',0,None) + return + if self.path.endswith('.jpg') or self.path.endswith('.jpeg'): + self._set_headers('image/jpeg',0,None) + return + if self.path.endswith('.gif'): + self._set_headers('image/gif',0,None) + return + if self.path.endswith('.webp'): + self._set_headers('image/webp',0,None) + return + if self.path.endswith('.mp4'): + self._set_headers('video/mp4',0,None) + return + if self.path.endswith('.ogv'): + self._set_headers('video/ogv',0,None) + return + if self.path.endswith('.mp3'): + self._set_headers('audio/mpeg',0,None) + return + if self.path.endswith('.ogg'): + self._set_headers('audio/ogg',0,None) + return + self._set_headers('application/json',0,None) def _receiveNewPostProcess(self,authorized: bool, \ postType: str,path: str,headers: {},