Try lower case for permissive headers

merge-requests/30/head
Bob Mottram 2021-08-12 13:42:01 +01:00
parent 0e268913f2
commit 962dcbe9bd
1 changed files with 15 additions and 4 deletions

View File

@ -683,12 +683,17 @@ class PubServer(BaseHTTPRequestHandler):
def _set_headers_base(self, fileFormat: str, length: int, cookie: str, def _set_headers_base(self, fileFormat: str, length: int, cookie: str,
callingDomain: str, permissive: bool) -> None: callingDomain: str, permissive: bool) -> None:
self.send_response(200) self.send_response(200)
if permissive:
# use lower case
self.send_header('content-type', fileFormat)
if length > -1:
self.send_header('content-Length', str(length))
self.send_header('host', callingDomain)
return
self.send_header('Content-type', fileFormat) self.send_header('Content-type', fileFormat)
if length > -1: if length > -1:
self.send_header('Content-Length', str(length)) self.send_header('Content-Length', str(length))
self.send_header('Host', callingDomain) self.send_header('Host', callingDomain)
if permissive:
return
if cookie: if cookie:
cookieStr = cookie cookieStr = cookie
if 'HttpOnly;' not in cookieStr: if 'HttpOnly;' not in cookieStr:
@ -713,7 +718,10 @@ class PubServer(BaseHTTPRequestHandler):
self._set_headers_base(fileFormat, length, None, callingDomain, self._set_headers_base(fileFormat, length, None, callingDomain,
permissive) permissive)
if etag: if etag:
self.send_header('ETag', '"' + etag + '"') if permissive:
self.send_header('etag', '"' + etag + '"')
else:
self.send_header('ETag', '"' + etag + '"')
self.end_headers() self.end_headers()
def _set_headers_etag(self, mediaFilename: str, fileFormat: str, def _set_headers_etag(self, mediaFilename: str, fileFormat: str,
@ -738,7 +746,10 @@ class PubServer(BaseHTTPRequestHandler):
except BaseException: except BaseException:
pass pass
if etag: if etag:
self.send_header('ETag', '"' + etag + '"') if permissive:
self.send_header('etag', '"' + etag + '"')
else:
self.send_header('ETag', '"' + etag + '"')
if lastModified: if lastModified:
self.send_header('last-modified', lastModified) self.send_header('last-modified', lastModified)
self.end_headers() self.end_headers()